How to Enable PHP on IIS 6.0
PHP (PHP: Hypertext Preprocessor) is a free programming language used primarily on Apache web servers to deliver web pages to client computers over the Internet. IIS is a package of server applications developed by Microsoft as an alternative to Apache, which usually runs on non-Windows machines. While PHP was developed to work on computers running Linux, it has been modified to work with Windows computers, including those running IIS 6.0. This guide assumes that you have a computer running Windows XP or Server 2003 with IIS 6.0 and some version of PHP already installed.
Instructions
-
PHP configuration
-
1
Open the file of PHP's startup directives. These are the options PHP initializes when it starts. The directives will be contained in a file called php.ini, which you will need to set up. You can use the default settings as a template by copying and renaming the file called php.ini-distribution.
-
2
Open your php.ini file in a text editing program.
-
-
3
Check and/or fill in the directives necessary to run PHP on IIS. Fill in the file path to the extensions directory on the line with the phrase "extension_dir". The file path is usually "C:\PHP\ext," but it may be different depending on where you installed PHP and the extensions folder.
-
4
Include the links to the .dll files for the extensions you have installed. Type each link in the following format on a new line under the "extension_dir" line:
extension = *.dll
Replace the "*" with the name of the file.
-
5
Find the line "log_errors" and set it to "On." Next, include the file path of the directory where you want PHP to save the error logs. The usual file path is C:\inetpub\temp\php-errors.log.
-
6
Set up PHP to work with IIS's CGI requests. Find or include the following directives and their corresponding values:
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
fastcgi.logging = 0
-
7
Configure other directives as you see fit. If you don't know what you are doing it is best to do some research or just leave the other directives to their default settings.
-
8
Save and close php.ini.
IIS configuration
-
9
Navigate to www.iis.net/extensions/fastcgi and download and install the appropriate version of the application. This application will help IIS work with PHP for processing appropriate requests.
-
10
Open a command prompt window.
-
11
Tell IIS where to route PHP requests. You will need to know the file path of the php-cgi.exe file. It may be located in the root of your PHP installation. Type the following into the command line, replacing the word FILE with the file path of php-cgi.exe:
cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"PHP" ^ -extension:php -path:"FILE"
-
12
Close the command prompt window.
-
1
References
Resources
- Photo Credit Mensch und Computer 5 image by Sven Rausch from Fotolia.com