- Latest PHP 5.3 Thread Safe Zip package for Windows - http://windows.php.net/download/
- FastCGI Extension for Internet Information Services 6.0 and 5.1 - http://blogs.iis.net/ruslany/archive/2009/04/20/fastcgi-extension-1-5-for-iis-6-0-and-iis-5-1-beta.aspx
- Microsoft Visual C++ 2008 Redistributable Package (x86) - http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en
Install and Configure PHP 5.3
Extract the contents of the PHP 5.3 Non Thread Safe Zip package for Windows to "C:\PHP". This will be your PHP installation directory. Go to "C:\PHP" and create a folder named "temp".
Configure the php.ini File
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
fastcgi.impersonate = 1
fastcgi.logging = 0
extension_dir = "C:\PHP\ext"
session.save_path = "C:\PHP\temp\"
upload_tmp_dir = "C:\PHP\temp\"
display_errors = On
display_startup_errors = On
log_errors = On
error_log = "C:\PHP\temp\phperror.txt"
extension = php_mysql.dll
extension = php_mysqli.dll
extension = php_curl.dll
extension = php_gd2.dll
extension=php_mbstring.dll
Configure the Path Variable
For PHP and its extensions to work properly, they need to access the DLLs present inside C:\PHP. The recommended method is to add "C:\PHP" to the Path Environment Variable. To do this Right-click on My Computer, click Properties and on the Advanced tab click Environment Variables. In the Environment Variables dialog box, under System variables highlight the Path variable and click Edit.
Add ";C:\PHP" (be sure to include the semi-colon separator) as shown here and click OK. You need to re-boot the server for this change to take effect.
Install and Configure FastCGI Extension
Run the FastCGI Extension for IIS 6.0 and 5.1 Installer (fcgisetup_1.5_rtw_x86.msi) to copy the necessary files to your machine. The FastCGI Extension can be configured by editing the "fcgiext.ini" file which is located in "C:\WINDOWS\system32\inetsrv\" directory. Edit this file to Notepad and add the following:
[Types]
php=PHP
[PHP]
ExePath=C:\PHP\php-cgi.exe
Arguments=-c C:\PHP\php.ini
Install Microsoft Visual C++ 2008 Redistributable Package (x86)
Run the Microsoft Visual C++ 2008 Redistributable Package (x86) (vcredist_x86.exe) to copy the necessary files to your machine.
Configure IIS 5.1
To route requests for PHP files to the FastCGI handler, you must associate .php files with the FastCGI Extension in IIS. This is done via Application Extension Mapping (also known as Script Mapping). Script maps associate file extensions with a script handler that executes when that file type is requested.
- Launch Internet Information Services (run inetmgr.exe).
- Expand the nodes in the left hand pane and locate Web Sites, right click on it and select Properties.
- On the Web Sites Properties windows choose Home Directory tab and click the Configuration... button.
- Make sure that the Application Mappings list does NOTcontain .php extension. Click the Add... button. Enter the following without the double quotes ("). Enter "C:\WINDOWS\system32\inetsrv\fcgiext.dll" as the Executable, enter ".php" as the Extension, limit the Verbs to "GET,HEAD,POST", and check the Script engine and Verify that file exists check-boxes.
- Launch Internet Information Services (run inetmgr.exe).
- Expand the nodes in the left hand pane and locate Web Sites, right click on it and select Properties.
- On the Web Sites Properties windows choose Documents, and make sure that the Enable Default Document check-box is checked
- Click on Add... button, enter "index.php" (without the double quotes) as the Default Document Name and click OK.
- Close all dialog boxes by clicking OK.
Run phpInfo.php for testing
Create "phpInfo.php" under "C:\Inetpub\wwwroot\" directory. Open the file at Notepad and type the following:
<?php
phpinfo();
?>
Now open "http://localhost/phpInfo.php" in your browser to view the result. If all goes well, the phpinfo page should appear and you have successfully install PHP 5.3 in IIS 5.1! If you have any comments, questions about the installation and suggestions please feel free to post here.
No comments:
Post a Comment