Installing PHP to run on Windows through IIS is pretty simple because there is an installation wizard that does everything for you. But, those of us who also have Apache running for development need to have Apache process PHP pages too. This is a walkthrough to get both running.
This will run PHP in CGI mode for both IIS and Apache.
1. Download from www.php.net the Windows Installer version of PHP AND the Windows “manual install” .zip distribution. (If you already have PHP running for IIS, then you only need the zip version)
2. Run the PHP installer. Install it to its default location of C:\PHP. PHP should now be working with IIS.
3. Move the file C:\PHP\php.ini-dist to C:\Windows\php.ini
3. Unzip the “manual install” distribution. You’ll notice that it has much of the same files as are already in C:\PHP. Move all the of extra directories contained in this .zip to C:\PHP
4. Download and install Apache HTTP server from www.apache.org. (I used version 2). Default install location is C:\Program Files\Apache Group\Apache2. The configuration you use is up to you, but i specify in the install wizard to run Apache manually on port 8080 so that it will co-exist with IIS (which is already on port 80). Then after that is done, I install it as a service by executing the command-line command: apache -k install
(from within the apache2\bin directory)
5. Edit the Apache configuration file C:\Program Files\Apache Group\Apache2\httpd.conf - make the following changes:
# search for “DirectoryIndex” and add index.php to the end:
DirectoryIndex index.html index.html.var index.php
# search for “ScriptAlias” and add the following lines in that section:
ScriptAlias /php/ “c:/php/”
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php.exe”
6. restart Apache and the new configuration should take effect. create a test PHP file and see how it works.
* caveat: if you use the same browser and surf back-and-forth between IIS and Apache, you may get a bunch of weird error messages about permission denied while writing session files. This is because Apache and IIS run as different users & they will block each other from writing to the same session file.
Share This