So like always, I trusted my friend Google. Unfortunately, most of the guides describing the procedure were either not precise or obsolete. Most of them relied on php5isapi.dll which is no longer packaged with PHP 5.3.2. However, after spending some time, I was able to successfully install PHP on IIS. I am writing this entry to help those who are facing the same situation as I was last week.
In this post, I have assumed that you are a programmer and well acquainted with Microsoft Windows XP. I will be describing the installation procedure but will not be telling you how to open or edit a file. Lets start now.
Since php5isapi.dll is not included in PHP anymore, first you need to install FastCGI from Microsoft's official website.http://www.iis.net/download/fastcgi
To learn about FastCGI extension, please visit the following site:
http://technet.microsoft.com/en-us/library/dd450382(WS.10).aspx
The installation is pretty simple since it is from Microsoft!
Now you need to download latest version of PHP which is 5.3.2 from:http://windows.php.net/download/
Please download Windows Binary VC9 x86 Non Thread Safe Zip Package. I am assuming here that you are using 32-bit architecture.
Extract the content of the package to C:\PHP. You can use a different path if you really need to. In this post, I will use this path everywhere so if you go for a different path, please use it everywhere.
Note that in C:\PHP folder, there is no php5isapi.dll file. However, we have php-cgi.exe file which will be useful for us later. There will be two php.ini files. One will be for use during development and one for use in production. I used the later one. So rename the production file php.ini-production to php.ini. Open this file and make sure that following entries appear like these. (Remove comments whenever required or change key values)
extension_dir = "C:\PHP\ext"
error_log="C:\inetpub\temp\php-errors.log"
cgi.force_redirect = 0
fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
Save and close the file. Please make sure that all files/folders exist as specified in the above entries.
Now go to Properties of My Computer->Advanced and set the system environment variable "Path" to ";c:\PHP\".
Once done, go to C:\Windows\System32\inetsrv folder and open file fcgiext.ini and add the following:
[Types]
php=PHP
[PHP]
ExePath=c:\php\php-cgi.exe
InstanceMaxRequests=10000
EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\PHP\
Restart your computer.
Once restarted, type "inetmgr" on Windows Run command.
View Properties of "Websites", open "Home Directory" tab and click on "Configuration" button.
Click "Add" and provide the following values:
1. "C:\Windows\System32\inetsrv\fcgiext.dll" to "Executable" field.
2. ".php" to "Extension" field.
3. "Get,Head,Post" to "Verbs- Limit to"
4. "Script engine" and "Check that file exists" checkboxes should be checked.
Now go to "Documents" tab and add "index.php" to the list of default documents.
Open notepad and enter a simple script:
phpinfo()
?>
Save it as "index.php". Make a virtual directory in IIS and copy "index.php" to your website. Please make sure that the settings you made for "Websites" earlier are propagated to this Website.
View "Properties" of the website you have just added in IIS and under "Virtual Directory" tab, set "Application Protection to "Low (IIS Process)". Restart IIS.
Now open your website in a browser and you should see a page like this:
I will try to add screen snapshots to this tutorial to make it more understabable.
Future extension to this post:
I will demonstrate how to install SugarCRM (Open Source CRM) on this platform alongwith SQL Server 2008.
Best of Luck!
JS