Friday, October 7, 2011

How To Install PHP on IIS 6.0

Configuring IIS to process PHP requests

Download and install PHP in accordance to the instructions described in manual installation steps

Note:

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.

Configure the CGI- and FastCGI-specific settings in php.ini file as shown below:

Example #1 CGI and FastCGI settings in php.ini

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

Download and install the » Microsoft FastCGI Extension for IIS 5.1 and 6.0. The extension is available for 32-bit and 64-bit platforms - select the right download package for your platform.

Configure the FastCGI extension to handle PHP-specific requests by running the command shown below. Replace the value of the "-path" parameter with the absolute file path to the php-cgi.exe file.

Example #2 Configuring FastCGI extension to handle PHP requests

cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"PHP" ^ -extension:php -path:"C:\PHP\php-cgi.exe" 

This command will create an IIS script mapping for *.php file extension, which will result in all URLs that end with .php being handled by FastCGI extension. Also, it will configure FastCGI extension to use the executable php-cgi.exe to process the PHP requests.

Check in the C:\WINDOWS\system32\inetsrv\fcgiext.ini file the next text is present or paste into it:

[Types]
php=c:\php\php-cgi.exe

[c:\php\php-cgi.exe]
QueueLength=999
MaxInstances=20
InstanceMaxRequests=10000
IdleTimeout=90
RequestTimeout=90

To create a script map for the FastCGI handler on IIS 6.0 and IIS 5.1:
  1. Open IIS Manager.
  2. Double-click the machine icon for the local computer.
  3. Right-click Web Sites and then click Properties.
  4. Click the Home Directory tab.
  5. Click the Configuration… button.
  6. Click the Add… button.
  7. Browse to %WINDIR%\system32\inetsrv\ and select fcgiext.dll as the executable file.
    Note: If you are using a 64-bit platform in WOW mode, you must use the fcgiext.dll file that is located in the %WINDIR%\SysWOW64\inetsrv path.
  8. In the Extension text box, enter .php (or another extension that is specific to your FastCGI application).
  9. Under Verbs, in the Limit to text box, enter GET,HEAD,POST.
  10. Select the Script engine and Verify that file exists check boxes.
  11. Click OK.

Set index.php as a default document in IIS

The IIS default documents are used for HTTP requests that do not specify a document name. With PHP applications, index.php usually acts as a default document. To add index.php to the list of IIS default documents, follow these steps:

  1. In the Windows Start Menu choose "Run:", type "inetmgr" and click "Ok";

  2. Right-click on the "Web Sites" node in the tree view and select "Properties";

  3. Click the "Documents" tab;

  4. Click the "Add..." button and enter "index.php" for the "Default content page:"


    Reference:

    http://learn.iis.net

    php.net

No comments: