PHP PHP Basics Getting to Know PHP Intro to Workspaces and PHP Code

Command-line on Windows

There is a way to execute PHP on windows prompt? How it works? What I have to install?

2 Answers

Corey Cramer
Corey Cramer
9,438 Points

First you need to download PHP and save it somewhere (e.g C:/php)

  • Go to Control Panel and open the System icon (Start → Control Panel)
  • Go to the Advanced tab
  • Click on the 'Environment Variables' button
  • Look into the 'System Variables' pane
  • Find the Path entry (you may need to scroll to find it)
  • Double click on the Path entry
  • Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)
  • Press OK
  • Restart your computer

Next time you open the command prompt type the following command to verify that it is working properly:

php -v

Thank you, I will try.