Installing PHP on Windows
This is for reference – the official docs are a bit messy and there’s been loads of times where it’s taken me hours to track down something silly.
Doing it this way allows PHP to be easily upgraded because there’s nothing hanging around in the system directories. Always install it manually – the CGI installer is no good and xampp etc are fine but you don’t know where you are when things go wrong.
This was for IIS on Server 2003 but it should work for XP.
1. Unpack PHP to somewhere like c:\php
2. Create a PHP session dir (e.g. c:\phpsession) and allow the IIS user to modify it. Set session.save_path in php.ini to this.
3. Rename php.ini.dist to php.ini. In php.ini: set magic_quotes_gpc to off and ensure register_globals is off; on a production site set error_reporting to E_ALL, set display_errors and display_startup_errors to off.
4. Also in php.ini comment out the doc_root line (this has given me problems in the past) and set extension_dir to the absolute path (e.g. c:\php\ext)
5. Environment variables – add the PHP dir to PATH, add PHPRC variable pointing to the directory where the php.ini file is (not to the actual file itself)
6. In IIS admin add the PHP application mapping. (website/home directory/configuration/application mappings and web server extensions – as specified in the docs http://uk.php.net/manual/en/install.windows.iis.php under the heading “Windows NT/200x/XP and IIS 4 or newer)
7. Restart the machine (needed for environment variables to work)