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
- Open IIS Manager.
- Double-click the machine icon for the local computer.
- Right-click Web Sites and then click Properties.
- Click the Home Directory tab.
- Click the Configuration… button.
- Click the Add… button.
- 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. - In the Extension text box, enter .php (or another extension that is specific to your FastCGI application).
- Under Verbs, in the Limit to text box, enter GET,HEAD,POST.
- Select the Script engine and Verify that file exists check boxes.
- 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:
In the Windows Start Menu choose "Run:", type "inetmgr" and click "Ok";
Right-click on the "Web Sites" node in the tree view and select "Properties";
Click the "Documents" tab;
Click the "Add..." button and enter "index.php" for the "Default content page:"
Reference:
php.net
No comments:
Post a Comment