Install PHP 5.3.5 with FPM (FastCGI Process Manager) support on Apache2/Centos 5.5

$> yum upgrade
$> yum groupinstall "Development Tools"
$> wget http://us2.php.net/get/php-5.3.5.tar.bz2/from/us.php.net/mirror
$> tar xvf php-5.3.5.tar.bz2
$> yum install mysql-server httpd-devel-* libxml2-devel-* openssl-devel* xmlsec1-openssl-devel-* libpng* libjpeg* curl-devel libmcrypt* mysql-devel* mysql.* libevent libevent-devel libtool-ltdl-devel libtool apr-devel apr
$> cd php-5.3.5
$> ./configure --with-mysql=shared --with-openssl --enable-pdo --with-pdo-mysql=shared --with-mhash=shared --enable-soap=shared --with-config-file-path=/etc/ --with-mysqli --enable-zip --enable-shared --with-curl --enable-mbstring=all --enable-maintainer-zts --with-jpeg-dir=/usr/lib/ --with-libdir=lib64 --enable-soap --with-pdo-mysql --with-gd --with-mcrypt --enable-fpm --with-config-file-scan-dir=/etc/php.d
$> make; make install;
$> chmod 705 /var/log/httpd

Edit your php.ini to point to your new PHP's extension directory (printed as part of make install above):
extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20090626/"

Make certain your /etc/php.d directory is only loading extensions that have been built against your new php. I only load mysql and apc

Now you need to tell Apache to use php-fpm via mod_fastcgi.
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
# tar -zxvf mod_fastcgi-current.tar.gz
# cd mod_fastcgi-2.4.6/
# cp Makefile.AP2 Makefile

Compile and install mod_fastcgi for 32 bit system, enter:
# make top_dir=/usr/lib/httpd
# make install top_dir=/usr/lib/httpd

Compile and install mod_fastcgi for 64 bit system, enter:
# make top_dir=/usr/lib64/httpd
# make install top_dir=/usr/lib64/httpd

Sample output:
make install top_dir=/usr/lib64/httpdmake[1]: Entering directory `/tmp/mod_fastcgi-2.4.6'/usr/lib64/apr-1/build/libtool --silent --mode=install cp mod_fastcgi.la /usr/lib64/httpd/modules/make[1]: Leaving directory `/tmp/mod_fastcgi-2.4.6'

Edit your Apache config to configure mod_fastcgi:
# mods-enabled/fastcgi.conf<IfModule mod_fastcgi.c>FastCGIExternalServer /usr/local/sbin/php-fpm -socket /tmp/php-fpm.sockAddHandler php-fastcgi .phpAction php-fastcgi /usr/local/sbin/php-fpm.fcgiScriptAlias /usr/local/sbin/php-fpm.fcgi /usr/local/sbin/php-fpm<Directory /usr/local/sbin>Options ExecCGI FollowSymLinksSetHandler fastcgi-scriptOrder allow,denyAllow from all</Directory></IfModule>

Now edit your /usr/local/etc/php-fpm config file using settings like these:
[www]# socketlisten = /tmp/php-fpm.socklisten.owner = apachelisten.group = apachelisten.mode = 0666# user ID/GIDuser = apachegroup = apache

Finally, configure an autostart script for your php-fpm daemon using these instructions.