RSS

How to Install PHP on IIS 6 for Windows Server 2003

25 Apr

How to Install PHP on IIS 6 for Windows Server 2003
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.

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.

image_thumb44

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’.

image_thumb45

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.

image_thumb46

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:

[Types]
php=PHP

[PHP]
ExePath=C:PHPphp-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.

image_thumb47

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.

image3_thumb

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

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

image_thumb49

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

image_thumb50

Once you have applied all the changes, restart IIS.

image_thumb51

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:

<?php phpinfo(); ?>

image_thumb52

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.

image_thumb53

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.

Links

Download PHP Windows Binaries (non thread safe)

Download IIS 6 FastCGI Extension

——————————————————————————–

Thanks for: http://www.howtogeek.com/50455/how-to-install-php-on-iis-6-for-windows-server-2003/

Advertisements
 
1 Comment

Posted by on April 25, 2013 in IIS

 

One response to “How to Install PHP on IIS 6 for Windows Server 2003

  1. aashishv11@gmail.com

    November 27, 2013 at 3:13 pm

    i am getting error 139 unexpected error, can you help

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: