PHP 5.6 on Windows Server 2008 and IIS

For the Old Computer Challenge 2025 I had the amazing idea that I wanted to have an old HP t5740 thin client as a public web server on the internet, running Windows Server 2008 and IIS. The goal was to host my own website on it, which requires at least PHP 5.6.

Since running PHP under IIS was never a straightforward process, although Microsoft did make it easy with the Microsoft Web Platform Installer 2.0, now days everything has been taken down and a bunch of information and archives are no longer available, so I decided to log my successful steps here in case anyone ever wants to replicate this in the future.

Prerequisites

This is an old system, and with older systems you need a great deal of responsibility, specially if you're going to expose any part of them to the public internet. Before continuing ensure that you have fully updated Server 2008 using Legacy Update, since out-of-the-box Windows Update won't work because of older TLS versions and expired certificates.

It's important to note that in order for PHP to run you do need to install the Microsoft Visual C++ 2012 Redistributable files. These are required since PHP was compiled with that version of Visual C++. Since a lot of software requires different versions of the redistributable files, my recommendation is always to install TechPowerUp's Visual C++ Redistributable Runtimes All-in-One pack, this will ensure you have all possible versions installed and save you from many headaches down the line.

Setting up FTP

Since nothing in Windows can be straightforward, the first problem started when I needed to enable FTP access so that I could send files to the server quickly for installation. This became a problem because as soon as I tried to do a directory listing after connecting to the FTP server it would hang indefinitely.

The reason for this was that Windows Firewall was blocking communication over the FTP passive ports. I tried using active mode and it worked perfectly fine, but since I wanted passive mode working, since that's easier to manage over all my machines, I had to resort to IIS 6 administration scripts and magic to get everyone happy. The fix involves limiting the port range of IIS's FTP server and allowing those specific ports through the firewall. This has the side-effect of limiting how many users you can have connected simultaneously.

The fix involves running the following IIS administration script (ensure you have installed the IIS 6 Scripting Tools role) and specifying the desired port range:

C:\Inetpub\AdminiScripts\adsutil.vbs set /MSFTPSVC/PassivePortRange "5500-5520"

Next step is simply going into the Windows Firewall settings and allowing Inbound Traffic through those ports.

Getting PHP Binaries

Since the last PHP 5 for Windows binaries are absent from the PHP Museum Archives, I had to use the Wayback Machine to fetch PHP 5.6.40 for Windows, the last version of the PHP 5 branch. In my case, since I'm running a 32-bit copy of Server 2008, I downloaded the VC11 x86 Non Thread Safe (2019-Jan-10 00:38:30) version.

Installing PHP

Next logical step was installing PHP 5.6, which in the case of Windows and IIS, requires a manual installation procedure.

Manually installing simply means that you have to unpack the ZIP archive of the PHP distribution onto a folder, usually C:\php, set the PATH system environment variable to point to this directory, and rename one of the included configuration file examples to php.ini.

A step that's needed is to set the following configuration variables accordingly:

fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0

This configuration is apparently required in order for PHP to work under IIS, at least according to the documentation.

Setting up IIS

The next logical step is to setup IIS 7 so that it can properly handle *.php files and execute the CGI handler. For the first step, following the tutorial, you should setup the Handler Mappings for PHP in the following manner:

Handler Mapping configuration for PHP

Next, in order for index.php files to get preference over other index files, you should open the Default Document view in the IIS server manager and add the index.php directive there. Move it up or down according to your preference of priority.

References

The following main tutorials by the PHP foundation were followed in order to have this up and running. These articles had to be fetched using the Wayback Machine since PHP already has taken them down in recent years.

log/php-windows.txt · Last modified: by nathanpc
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki