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:wamp64binphpphp5.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.

Comments

5 responses to “Running PHP at a Windows 10 Command Line”

  1. Unknown Avatar

    Thanks for providing this informative information…..
    You may also refer-
    http://www.s4techno.com/blog/category/application/php/

  2. Michael Fulton Avatar

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

  3. Bill Karwin Avatar

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

  4. San Avatar

    Wasted 6-7 hours in solving the issue which I solved by watching this thread in minutes, Thanks A lot

  5. Ki Sudrun Avatar

    Thank's ..it works

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.