Thursday, July 14, 2016

Running PHP at a Windows 10 Command Line

A technical writer friend of mine asked me to help her this week. She needs to run PHP scripts at the command-line on Windows 10. She installed WAMP Server which includes PHP. I think she just needs to change the PATH so when she runs "php" in a command window, it will find the PHP interpreter.

I hardly use Windows these days. But I do have a Windows PC around, so I tried installing WAMP, and then figuring out what it takes to change one's PATH on Windows these days. Here are the steps, with screen shots.

1. Open Windows Settings and click the System icon:

2. Click the "About" link

3. Click the "System info" link

4. Click the "Advanced system settings" link

5. Click the "Environment Variables..." button

6. Select the "Path" variable and click the "Edit..." button

7. Click the "Browse..." button

8. Browse to the directory "C:\wamp64\bin\php\php5.6.19" and click the "Ok" button

9. Continue clicking the "Ok" buttons for all the windows that you opened during this exercise

10. Open a command shell window and run "php -v" to confirm you can now use PHP via your PATH.

Now you should be able to run PHP in the command window from any directory.


Unknown said...

Thanks for providing this informative information…..
You may also refer-

Michael Fulton said...

Steps 1-5 can be condensed to searching "env" from the Start menu ��

Bill Karwin said...

Thanks Michael, that's a great help. I developed this for a friend who preferred the GUI way of finding the environment variables.

karthik anu said...

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
iOS Training in Chennai
Android Training in Chennai
php Training in Chennai