If you’re like most web developers, you’re probably using IIS 6 to power your websites. But if you’re also a PHP developer, IIS 6 might not be the best platform for you. In this article, we’ll show you how to install PHP on IIS 6 for Windows Server 2003 so that your websites can run faster and more efficiently. PHP is a popular scripting language that’s used by millions of web developers around the world. It’s especially popular among bloggers and small businesses because it’s easy to learn and use. But because PHP is a server-side language, it needs a platform like IIS 6 to run on. IIS 6 is an old platform that was released in 2003. It’s no longer supported by Microsoft, so there are few updates or new features available for it. However, because PHP is still widely used, installing it on IIS 6 can give your websites a performance boost. To install PHP on IIS 6 for Windows Server 2003:

  1. Open the Control Panel and click System and Security.
  2. Under System Properties, click the Internet Information Services (IIS) tab.
  3. Under Web Sites, click Add Web Site or Add Website Group…
  4. In the Add Web Site or Add Website Group dialog box, type php in the Name text box and click OK.
  5. In the Address field of the newly created website group or website, type http://localhost:8080/ in the Address text box and click OK.
  6. Click OK in all other dialog boxes to close them and return to IIS Manager window.
  7. Double-click php website group or php website to open its properties window (see Figure 1). Figure 1: The Properties Window of a Newly Created php Website Group or Website 8) On the General tab of this window (see Figure 2), set Initial Directory value as C:\PH ..

Configuring PHP

In order for Windows to run PHP code, the PHP binary files need to be copied to your system. No installation is required, however some configuration must be done in order for it to properly run. The first step is to download the PHP Windows Binaries and extract them (i.e. ‘C:PHP’). For IIS 6, the non thread safe binaries should be used.

Copy the ‘php.ini-production’ file from the extracted files paste it into the Windows directory. In the Windows directory, rename this file to ‘php.ini’.

Open the ‘php.ini’ file in Notepad and configure it as needed. Out of the box, the production configuration we copied is preconfigured for what the PHP Team feels is good for a production server. There are a few changes you will need to make to configure PHP for your IIS 6 system:

Uncomment and set the key, cgi. force_redirect = 0 Uncomment the key, fastcgi. impersonate = 1 Uncomment and set the key, extension_dir to the ‘ext’ folder in the path PHP was extracted to (i. e. ‘C:PHPext’). Set the key, date. timezone to the time zone of your server (the URL on the line above this key lists the accepted values).

At this point, your Windows system can run PHP scripts from the command line using the ‘php.exe’ tool.

Installing the IIS 6 FastCGI Extension

In order for Internet Information Services (IIS) 6 to execute and serve PHP scripts, some additional configuration is required. In this guide, we will install PHP on IIS using the FastCGI interface which provides a good balance of stability and performance. Since FastCGI is not included with IIS 6 be default, we need to download and install it.

The FastCGI installer does not require any configuration, however once the FastCGI extension is installed we need to configure it to run PHP.

Open the file ‘C:WINDOWSsystem32inetsrvfcgiext.ini’ in Notepad and find the ‘Types’ section and enter the configuration information:

Revise these values as needed according to your environment, but it is important that all of settings have the correct values. Once you are finished, save this file.

[PHP] ExePath=C:PHPphp-cgi.exe InstanceMaxRequests=5000 EnvironmentVars=PHP_MAX_REQUESTS:5000

Configuring IIS to Run PHP via FastCGI

With both PHP and FastCGI installed and configured, all that is left is to set up IIS 6. When you open the IIS Management Console, under the Web Service Extensions make sure the “FastCGI Handler” is set to allowed.

Next, go to the Properties settings for the Web Sites group.

On the “Home Directory” tab, click the “Configuration” button.

Add a mapping for files with the .php file extension with the executable set to the FastCGI extension DLL.

Once you have applied all the changes, restart IIS.

Testing PHP

At this point, your server is ready to go, but just to be sure we can confirm your PHP setup through IIS pretty easily. Create a text file in the directory ‘C:Inetpubwwwroot’ named ‘phpinfo.php’ which simply contains the line:

Finally, browse to the address: ‘http://localhost/phpinfo.php’ on your server and you should see the PHP information page. If the page loads successfully, PHP is now up and running on your machine.

Conclusion

Once you have PHP up and running on your Windows system, you can take advantage of the multitude of PHP based applications available as well as develop and deploy your own.

Download PHP Windows Binaries (non thread safe)

Download IIS 6 FastCGI Extension