Saturday, February 26, 2011

Integrating PHP 5.x with IIS part 1


How to Install PHP 5.x on Windows XP Pro

Once you download the PHP Windows Binaries Zip Package (For Windows XP Pro, I used the Win32-VC9-x86 non thread safe version of the zip file.), unzip it to c:\php. (If you had an older version of php installed rename that directory to c:\php-old then create a new c:\php to unzip the files to.

The newer versions of PHP do not include php5isapi.dll. They use the FastCGI php. I have only tried installing and testing this using IIS 5.1 on XP Pro.

1. First you will need to have the FastCGI for IIS extension installed. You can download it from http://www.iis.net/expand/FastCGI. I chose to download and install the x86 version for FastCGI 1.5 for IIS 6 even though my version of IIS is 5.1. Once you start the install it will say that it is also for 5.1.


2. I followed the instructions for "Manually Configuring FastCGI Extension to Work with PHP" in this document, http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/ to configure my system to use FastCGI.


3. Note: To launch inetmgr.exe, you can either


1. go to Start > Rung and type inetmgr.exe in the Open field and press OK or


2. go to Start -> Control Panel -> (Performance and Maintenance) ->Administrative Tools -> Internet Information Services


4. The newer version of php does not have an initial php.ini although it does have a development and production .ini that you can rename to a php.ini. I started with the php.ini-production, renamed it to php.ini and modified it as they suggested in the above doc.


5. Of course, it was not as easy as that. I kept getting all different kinds of problems when I tried running the Cinema Premiere Personal Server. For a while I was getting Page Not Found and then I made some other changes and then it started trying to download the .php files instead of running them. So I went back and made sure I installed php correctly and researched these problems with php on the internet. I previously had an older version of php installed that ran php5isapi.dll which caused additional issues. I tried so many different things until I finally got it working. This is what I did.


1. I went back into Internet Information Services (inetmgr.exe)
* Double click the machine icon for the local computer.
o Right click on "Web Sites" and pick "Properties."
o Click the "Home Directory" tab.
o Click the "Configuration…" button.
o I made sure that .php had the executable panth set to fcgiext.dll located in %WINDIR%\system32\inetsrv.
* Then I went back to the Internet Information Services main window under the local computer I double clicked or opened the Web Sites folder.
o Right click on "Default Web Site" and pick "Properties."
o Click the "Home Directory" tab.
o Click the "Configuration…" button.
o I made sure that .php had the executable panth set to fcgiext.dll located in %WINDIR%\system32\inetsrv. It was not. It was set to php5isapi.dll so I changed it.


  2. Since I still had problems I modified the php.ini some more. I tried so many different things in the php.ini that I don't remember which fields I ended up setting to what, but this is the php.ini that finally worked. Download php.ini It must be in your php directory.

3. I also tried many different settings in the fcgiext.ini located in %WINDIR%\system32\inetsrv until I finally got it to work. Download fcgiext.ini

4. Also, just to be sure I rebooted my PC after making these changes. You may be able to just stop and start the services, but I wanted to make sure everything was reset.









No comments:

Post a Comment