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 the latest PHP Source Code/Binary from the official website. Put it under preferred location, in my case, I put it under “C:\PHP” After it’s done, you can check the version of PHP by typing the following command:

php -v

PHP Environment

Installing XAMPP server

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

Checking/Fixing Default Port Issue (if any)

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

Install PHP Environment

In order to fix this issue needed to stop the windows service named “World Wide Web Publishing Service”, and start XAMPP, and try to run apache again.

PHP Development Environment


And it’s running successfully!

How to Set Up PHP Development Environment

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

Install PHP Development Environment in Windows

VS Code for PHP Editing

VS Code is one of the leading code editors. It’s open-source from Microsoft, you can get it from here. In order to have added development advantage, you can install PHP extensions such as “PHP IntelliSense” and “PHP Debug”

VS Code for PHP Editing

Testing PHP File

Finally, any PHP file(s) needed to be executed should be put under “htdocs” folder under XAMPP install location. On my PC it’s under “C:\xampp\htdocs”. Once the file is in place, we can test it out by navigating it under localhost in the browser.

Testing PHP File

In this brief tutorial, you learned how to install a PHP development environment in Windows.