PHP Installation

Setting up PHP as Fast CGI (FCGI) under Apache

1) Download the Apache mod_fcgi module: http://fastcgi.coremail.cn/

2) Configuration in your Apache httpd.conf:
a) LoadModule fcgid_module modules/mod_fcgid.so

b.1) <Directory "C:/Apache2/htdocs/php/">
    SetHandler fcgid-script
    Options execCGI

Running Apache + PHP + Accelerators under Windows 2003

I have been getting some instability running Apache with PHP + Accelerators under Windows 2003. I will log my finds in this article. Visit regularly for updates. I ended up running 7 Apaches on a Windows 2003 Server to test all different kinds of configurations. Recently because it was becoming complex, I started logging my finds. This page is probably for the hardcore debugging type...

Mitigating factors:
- Most crash seem to happen because of load (with very low traffic you might never experience problems).
- My PHP applications are very demanding. Especially Gallery2 which relies on external libraries for processing images. Again other PHP applications might not experience these problems.
-If you have issues with IIS, these finding might also be applicable.

Install PHP in CGI mode on Apache 2.x

Running PHP in CGI mode on Apache 2.x

I was running PHP as a module under Apache and decided to try the cgi mode. The instruction all over the web are pretty simple.
Add the following to your httpd.conf:

ScriptAlias /php52/ "E:/A22/php520/"
SetEnv PHPRC "E:/A22/php520/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php52/php-cgi.exe"

The SetEnv line is useful to indicate were to look for your php.ini first.

PHP Install

1) Download PHP: http://www.php.net/downloads.php (for more control over the install use the zip version)
Daily PHP snapshot can be found here: http://snaps.php.net/

2) Install following instructions provided by Php.net (see install.txt and/or http://us2.php.net/manual/en/install.windows.php).
Basically, upload the PHP folder to your server (make sure the web user has read access/permissions to the appropriate files), also need "write permissions" on some temp folders.

3) Customize the php configuration file (php.ini) for your setup (Apache or IIS).
It seems that PHP will try to load a specific .ini file before calling the default php.ini. It will looks for these files in a series of folders (local folder of the calling .exe then the directories in your path).
php-apache2handler.ini is the first attempt for php5apache2.dll php4apache2.dll
php-isapi.ini is the first attempt for php5isapi.dll
php-cgi-fcgi.ini is the first attempt for php-cgi.exe

For more information about phph.ini see: Php.ini common directives

IIS: Install PHP connector

I've done many of these installs. Most of my servers run IIS5 with PHP4.x, but right now I'm in Apacheland.
I will review this later. But it's probably nearly good to go.

As a general note, remember IUSR_WebUser needs read permission on any files required to execute PHP (PHP connector DLL and/or EXE plus depend DLLs and the extensions), and read/write permissions to the session & upload folders.
These are defined in the php.ini, see: Php.ini common directives

Once you have PHP nicely installed, see: PHP Install
You need to add the connector to IIS.

It's pretty well documented here: http://us2.php.net/manual/en/install.windows.php

Apache: PHP Quick Shift Install

Once familiar with the install process, see: Apache: Install PHP
In order to quickly shift between PHP versions here is my setup.

1) In your "bin" folder create a phpXXX folder (with XXX being the PHP version).
Example: E:\apache2\bin\php442

2) Copy the following 17 files, from your PHP version, to your phpXXX folder:
expat.dll