Setting-up PHP Development Environment in Windows

Written on May 27, 2020
  1. Installing PHP in Windows
  2. Installing XAMPP server
  3. Checking/Fixing default port issue (if any)
  4. VS Code for PHP Editing
  5. Testing PHP file

Installing PHP in Windows

Download latest PHP Source Code/Binary from official website. Put it under preferred location, in my case i put under "C:\PHP" After it's done, you can check version of PHP by typing following command.

php -v




Installing XAMPP server

Though here we only need apache server for running PHP website, XAMPP server provides good options. To install XAMPP, there are many website available for example this one.




Checking/Fixing default port issue (if any)

In my machine port 80 was alreay being used, and i wanted to use same port. XAMPP was erroring out at the start of apache due to port issue.

In order to fix this issue needed to stopped windows service named "World Wide Web Publishing Service", and start xampp and try run apache again.

And it's running successfully!

To confirm whether PHP instance is up and running fire-up localhost in browser, it should display default PHP website.




VS Code for PHP Editing

VS Code is one of the leading code editor. It's open source from microsoft, you can get it from here. In order to have added developemnt advantage, you can intall PHP extensions such as "PHP IntelliSense" and "PHP Debug"




Testing PHP file

Finally any php file(s) needed to be executed should be putted under "htdocs" folder under xampp install location. In my PC it's under "C:\xampp\htdocs". Once file is at place, we can test it out by navigating it under localhost in browser.