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.

No comments: