Wednesday, December 1, 2010

Install PHP 5.3.3 for IIS7 in Windows 7

1. Enable IIS 7 from Control Panel>Programs and Features>Turn Windows Features on or off, and make sure CGI feature is selected.

2. download and Unzip the PHP5.3.3 package in c:\php5.33

3. Configure IIS7 to support PHP5.3, that involves couple of steps:
1). Launch Internet Information Services (IIS) Manager from Control Panel>System and security>Administrative Tools
2). Browse to FastCGI and open it, and then hit [Add Application], in the [Full Path], enter C:\php5.33\php-cgi.exe (that is my case), final hit [OK] button.
3). Back to IIS main page, open [Handler mapping], hit [add module mapping], enter *.php in the [request path] field, and select FastCgiModule from the Module dropdown list, enter C:\php5.33\php5-cgi.exe in the [Executable] textbox, and enter php in the [name] filed, finally hit [OK], and confirm the creation.
4).From IIS7 main page, open the [default document], and add index.php to the default document list.

4. Back to c:\php5.33 folder, make a copy of php.ini-development, and rename it to php.ini; and open Computer Properties, and add C:\php5.33 to the environmental variable PATH. Next edit php.ini to enable php_mysql module or more, and set the timezone to your area, for example, America/Los_Angeles.

5. Make sure Network service and local service have read access to c:\inetpub\wwwroot, and give IUSR and IIS_IUSR users the read/execute rights in c:\php5.33 folder.

6. Restart the Word Wide Web publishing service.

7. Open your browser and navigate to a php page, and it's done, and you can test from the Command line with this command: php.exe -i