I’ve always liked PHP for creating dynamic Web pages. I find PHP to be much simpler than ASP.NET for some kinds of Web sites.
However, installing PHP on a Windows machine has always been kind of a pain in the patooty. It is possible install PHP using the Microsoft Web Platform Installer, but I prefer to manually install PHP because if something goes wrong using the Web Installer, it’s very, very difficult to fix, but errors in a manual install are easier to track down.
There are five basic steps to install PHP on a Windows 10 machine:
1. Enable (if necessary) IIS on the machine, and IIS-CGI on the machine.
2. Download and extract PHP to C:\PHP
3. Configure the php.ini configuration file
4. Configure IIS to handle PHP page requests
5. Test everything
So, here we go. My instructions are highly abbreviated and are intended for someone who has a medium amount of familiarity with Windows and IIS.
1. Configure IIS
Control Panel | Programs | Turn Windows features on or off
Check Internet Information Services
Check IIS | World Wide Web Services | Application Development Features | CGI
2. Install the NTS (non-thread safe) 64-bit version of PHP
Download and save onto the machine:
Extract all the contents of the zip file to C:\PHP
Now edit the System PATH variable so IIS knows where the PHP executables are:
Control Panel | System and Security | System | Advanced System Settings
System Variables | Path | Edit
New -> C:\PHP
3. Configure the php.ini file. This is the part you’d never figure out without some help.
Make a copy of file C:\PHP\php.ini-development and save it as C:\PHP\php.ini
Edit file php.ini by finding the following entries, uncomment them, and change values to:
1. fastcgi.impersonate = 1
2. cgi.fix_pathinfo = 0
3. cgi.force_redirect = 0
4. open_basedir = “C:\inetpub\wwwroot”
5. extension_dir = “ext”
7. uncomment the 24 Windows Extensions entries:
Save the edited php.ini file.
4. Configure IIS to work with PHP
Run | inetmgr
Handler Mappings | Add Module Mapping
Request path: *.php
Module: FastCgiModule (from the dropdown)
Executable (optional): C:\PHP\php-cgi.exe
5. Test the installation and configuration
Launch Notepad with Administrative privleges. Create a file test.php and save it at C:\inetpub\wwwroot. The contents are (I use an image because my blog software would choke on HTML text):
Now launch a browser and navigate to
And hopefully it works. There’s a LOT that can go wrong, but by Googling one error at a time you should eventually be able to get a Windows 10 machine with IIS to serve up PHP Web pages.