You can install the remi repo which contains php 5.3.x and php-fpm, and allows you to maintain everything in your package manager. I have used this repo for CentOS versions 5.7 all the way to 6.3. You are more than available to compile php-fpm via the instructions provided here and follow the instructions for the ini configuration here, but I find them highly over complicated, and difficult to maintain as they are outside of package management.
Enterprise Linux 5 (with EPEL)
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
Enterprise Linux 6 (with EPEL)
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Once you have this repo installed, you will be able to search the repo so that you can find whatever PHP you need.
[root@puppetmaster ~]# yum list php.x86_64 --enablerepo=remi
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: centos.mirrors.chicagovps.net
* epel: mirror.steadfast.net
* extras: mirror.steadfast.net
* remi: remi-mirror.dedipower.com
* updates: centos.mirrors.chicagovps.net
Available Packages
php.x86_64 5.3.18-1.el6.remi remi
[root@puppetmaster ~]# yum list php-fpm --enablerepo=remi
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: yum.singlehop.com
* epel: mirror.steadfast.net
* extras: mirror.steadfast.net
* remi: remirpm.mirror.gymkl.ch
* updates: mirror.steadfast.net
Available Packages
php-fpm.x86_64 5.3.18-1.el6.remi remi
You are more than able to search for anything that you may need to get out of the repo, whether it be mbstring, mcrypt, mysql, mysqlnd.
Once you have everything installed to your wishes, you can simply start php-fpm like you would any other service.
[root@puppetmaster ~]# service php-fpm start
Starting php-fpm: [ OK ]
You will need to configure nginx to know what the upstream is, this can be done via nginx.conf inside the http {} level of the config, by default php-fpm will start using port 9000
[root@puppetmaster ~]# netstat -na | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
You can change how your pool is created by editing your [something] pool to reflect something like this.
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
The below allows you to create an alias that you can use to simple the readability of your configs.
upstream base_backend {
#server unix:/var/run/php-fpm.sock;
server 127.0.0.1:9000;
}
You can direct your PHP scripts inside your server {} level of the config so that php-fpm will actual execute them.
location ~ \.php$ { ## Execute PHP scripts
expires off; ## Do not cache dynamic content
fastcgi_pass base_backend;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}