WITHOUT disabling MOD_PHP in Apache
Compile module:
yum -y install httpd-devel gcc mkdir /home/rack/fastcgi cd /home/rack/fastcgi wget https://github.com/whyneus/magneto-ponies/raw/master/mod_fastcgi-SNAP-0910052141.tar.gz tar -zxf mod_fastcgi* cd mod_fastcgi-* make -f Makefile.AP2 top_dir=/usr/lib64/httpd cp .libs/mod_fastcgi.so /usr/lib64/httpd/modules/
Enable the module:
echo "LoadModule fastcgi_module /usr/lib64/httpd/modules/mod_fastcgi.so" >> /etc/httpd/conf.d/fastcgi.conf
Install php-fpm and create pools like this:
[$USER] listen = /dev/shm/$USER-php5-fpm.sock user = $USER group = $USER listen.owner = $USER listen.group = apache listen.mode = 0666 pm = dynamic pm.max_children = 35 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 25 slowlog = /var/log/php-fpm/$USER-slow.log php_admin_value[error_log] = /var/log/php-fpm/$USER-error.log php_admin_flag[log_errors] = on php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/session/$USER/
NOTE: Make sure the path /var/lib/php/session/$USER/ exists and its owned by $USER!
Add this in the VHOST configuration (before the end of </VirtualHost>) )
FastCGIExternalServer /dev/shm/$USER-php.fcgi -socket /dev/shm/$USER-php5-fpm.sock -flush -idle-timeout 1800 AddHandler php-fpm .php Action php-fpm /php.fcgi Alias /php.fcgi /dev/shm/$USER-php.fcgi DirectoryIndex index.php <FilesMatch "\.php$"> SetHandler php-fpm </FilesMatch>