ARTICLE
How to install php5 support on Windows 2003 Server running IIS6
STEPS
- Download the correct files for php5. Browse to http://www.php.net/downloads.php and download the zip package under "Windows Binaries" Do not get the installer! .
- Once downloaded, extract the zip package to "C:\php" directory.
- Make a copy of the file C:\php\php.ini-recommended and name it C:\php\php.ini. This will be your main php configuration file.
- Open the php.ini file and make necessary changes.
- Add "C:\php" to your Windows Environmental Variables path.
- Add to the registry HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\PHP.
- Configure IIS
- Add read access with inheritable permissions for the IUSER_MACHINENAME for the C:\php dir
- Test installation.
Step 1 & 2 (Download the correct files for php5, Once downloaded, extract the zip package to "C:\php" directory)
Download the latest zipped distribution, not the Windows installer, of PHP from the "Windows Binaries" section of http://php.net/downloads.php. Unzip it somewhere on your hard drive. It is suggested to unzip to your system root, c:\php, which is assumed for the rest of this document.
Step 3 & 4 (Make a copy of the file C:\php\php.ini-recommended and name it C:\php\php.ini and make the following changes to this file)
- Uncomment cgi.force_redirect in php.ini and set = 0
- Create a session state folder and point the session.save_path php.ini variable to it. We recommend creating a directory under your php installation to hold the session files used by the server i.e. "c:\php\sessions".
- Change the value of the session.save_path variable in php.ini to be the full path to that folder (session.save_path=c:\php\sessions).
- Uncomment any extensions you wish to use.
Step 5 (Add "C:\php" to your Windows Environmental Variables path)
- Right-click on My Computer, choose Properties
- Select the Advanced tab
- Click the Environment Variables button
- Double-click the Path variable in the list of System variables.
- Add "c:\php;" (sans quotes) to the beginning of this path string.
- Click OK to close this window.
Step 6 (Add to the registry HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\PHP)
You can open regedit and do this manually or create your own registry key file to perform this for you.
- Simply copy the text above into a notepad file and name it inifilepath.reg and save it using Save as type: "All files" to your desktop.
- Double click this file to create the registry key by clicking "Yes" when presented with the confirmation dialog box.
Step 7 (Configure IIS)
Add and allow the PHP ISAPI Extension to IIS Web Service Extensions: c:\php\php5isapi.dll by using the following steps
- Expand the local computer in the left pane
- Click on "Web Service Extensions" in the left pane
- In the right pane, click the blue underlined text, "Add a new Web service extension..."
- Enter "PHP ISAPI Extension" as the "Extension name"
- Click the "Add..." button and browse to the php5isapi.dll file in your PHP install folder
- Check the "Set extension status to Allowed" checkbox and click "OK"
Add new extension (.php) to your website/s
- Expand the local computer in the left pane
- Right-click on "Web Sites" in the left pane, then click "Properties" in the menu that pops up
- Flip to the "Home Directory" tab
- Click "Configuration"
- Flip to the "Mappings" tab
- Click "Add..."
- Enter the full path to php5isapi.dll in the "Executable" textbox (Browse... to find it more easily if you need to)
- Enter ".php" in the "Extension" textbox
- Select radial button "Limit to", enter "GET,POST,HEAD"
- Click "OK" all the way out
Step 8 (Add read access with inheritable permissions for the IUSER_MACHINENAME for the C:\php dir)
Set the security permission noted above on the c:\php directory for the IUSER_MACHINENAME otherwise you will receive a permissions (401.3) error when browsing any .php files on your site.