Setting up PHP/PHP-CGI on Windows Server 2003 - IIS-6



PHP/PHP-CGI on Windows Server 2003


If you want to setup php-cgi instead of php, you can modify the steps shown below to 'php-cgi' instead of 'php'.

You can give php-cgi.exe instead of php.exe. All other remains the same.

Here i am using windows server 2003 and IIS6.0. PHP zip file is extracted in  C:\PHP directory. It is assumed default ACLs/Permissions.


1. Unzip the latest PHP ZIP file to C:\PHP, and copy php.ini-recommended from that folder to C:\windows\php.ini, then copy php5ts.dll to C:\Windows\System32. Also Rename C:\php\php.ini-recommended to C:\php\php.ini and then COPY it to C:\Windows





2. Load IIS from the Administrative tools in the Control Panel by clicking Start -> Administrative Tools -> IIS Manager.





3. Click the name of your computer then click "Web Service Extensions", on the left side of the main frame you can find a green arrow pointing to a link that says "Add a new Web service extension...", click that link.






4. Set the extension name to anything you'd like. Here i created in name, 'PHP' put C:\PHP\php.exe as the Required file, also check "Set status to allowed"




5. Go to the directory you'd like to configure PHP for in the IIS Manager(Here the name of the directory is 'phpscript'), right click it, and select properties.
I have created the directory by running, 'md c:\inetpub\wwwroot\phpscript' in cmd.





6. Click the Create button, set the Execute permissions to "Scripts only", then click the Configuration button.




7. Click Add.  For the Executable put - C:\PHP\php.exe for the Extension put ".php", set the verbs to all, and make sure the bottom check boxes are checked. Then Click OK and OK.








8. Create a phpinfo page in the directory,c:\inetpub\wwwroot\phpscript. Here i have created info.php and verified the result, by loading the following url from the server.
http://127.0.0.1/phpscript/info.php



That's it..