- Installing PHP in Windows
- Installing XAMPP server
- Checking/Fixing default port issue (if any)
- VS Code for PHP Editing
- 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:
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.
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.
And it’s running successfully!
To confirm whether the PHP instance is up and running fire-up localhost in the browser, it should display the default PHP website.
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”
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.
In this brief tutorial, you learned how to install a PHP development environment in Windows.