Jump to content

[SOLVED] PHP CLI Windows Environment Variable?


AbydosGater

Recommended Posts

Hey Guys,

I recently had to uninstall Apache2Triad due to problems with PHP on the command line.

I now have WAMPserver installed and everything looks to be going good.

 

One question i hope someone could help me with. When i was using A2T, "PHP" was a recognised command for cmd. But now that it is uninstalled it is not.

 

IE: To run a php script i just had to type "php c:\path\2\file.php" and it would run the file.

Now thats not working.. Would anyone know how i could add that back into the System so it would work again?

 

Thanks,

Andy

Link to comment
Share on other sites

You'll need to add the php folder to the Windows PATH variable

 

Start > Control Panel > System > Advanced tab > Environment Variables

 

Select the PATH from the system environment variables box and press edit button. Press the End key on your keyword now type ;C:/wamp/php; (NOTE: DO NOT DELETE ANYTHING THAT IS ALREADY SET) Click Ok on all remaining windows. Now restart Windows for Windows to apply the changes made.

 

Open up a command prompt php should now be recognised.

Link to comment
Share on other sites

Hey back up and running! Yes Yay wildteen your Great!

Thank you so much

 

Just one other problem im getting now. I will post here instead of posting a whole new topic.

 

Most of my dev scripts i just use short opening tags (<?  and  ?>) .. And in my NEW php.ini file i have:

short_open_tag = On

 

But even with that done and all apache and other services restarted..

 

Im when i run my script via command line it just displays the code not actually runs the script.

 

When i change the <? to <?php on one of my scripts everything runs fine..

 

But i cant go through hundreds of testing files to change them all..

 

Anyone know why this is happening?

 

UPDATE: Short opening tags are working Via browser just not command line where i need them :P

Link to comment
Share on other sites

I think you'll find the cli usually has its own php.ini. See if you can find it by typing....

 

php -i

 

at a prompt.

 

PS: It would be a good idea to get in the habbit of using the proper <?php tags from now on.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.