One of most popular development platforms on the web is PHP which powers many popular applications and sites such as Facebook, WordPress and Joomla. While most of these systems are 'designed' to be used on a Linux system running the Apache Web Server, you can deploy PHP applications via IIS 6 on your Windows Server 2003 system.
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.
Download PHP from PHP official website.
Non-thread-safe build of PHP is recommended when using IIS. The non-thread-safe builds are available at » PHP for Windows: Binaries and Sources Releases.
If your're using Microsoft Windows Server 2003 x86/x64, download PHP 5.4.x version.
php.ini-production file from the extracted files paste it into the Windows directory. In the Windows directory, rename this file to 'php.ini'.
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.
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
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. To install needs .NET Framework 2.0 support, you can Download .NET Framework Offline Installers from Microsoft Server.
If Microsoft Web Platform Installer doesn't work normally, we can direct download FastCGI for IIS on buttom of The Official Microsoft IIS Site.
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:\WINDOWS\system32\inetsrv\fcgiext.ini in Notepad and find the
Types section and enter the configuration information:
[Types] php=PHP [PHP] ExePath=C:\PHP\php-cgi.exe InstanceMaxRequests=5000 EnvironmentVars=PHP_MAX_REQUESTS:5000
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.
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.
Home Directory tab, click the
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.
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
phpinfo.php which simply contains the line:
<?php phpinfo(); ?>
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.
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.
Reference PHP: Microsoft IIS 5.1 and IIS 6.0