How to Install PHP-FPM on CentOS 6.2

PHP-FPM (FastCGI Process Manager) is a PHP FastCGI implementation and is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. PHP-FPM is a set of patches for PHP to work with the FastCGI process manager, turning PHP-FPM into a service rather than loading all of its libraries everytime a PHP request it’s made. In this post, i will show on how to install PHP-FPM on linux CentOS 6.2 server. Assume that you have configured EPEL and remi repositories on you linux CentOS 6.2 server.
How to Install and Configure EPEL Repository on CentOS 6.2
How to Install Remi yum Repository on CentOS 6.2

See also  How to Install Jenkins on Ubuntu

1. How to install PHP and other php extensions :

[root@centos62 ~]# yum --enablerepo=remi install php php-fpm php-common php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

Output :

  Installing : libmemcached-1.0.4-1.el6.remi.i686                                              8/23
  Installing : php-pecl-memcached-2.0.1-2.el6.remi.i686                                        9/23
  Installing : php-mysql-5.4.0-1.el6.remi.i686                                                10/23
  Installing : php-gd-5.4.0-1.el6.remi.i686                                                   11/23
  Installing : php-pecl-mongo-1.2.10-2.el6.remi.i686                                          12/23
  Installing : php-pecl-apc-3.1.10-2.el6.remi.i686                                            13/23
  Installing : php-pecl-memcache-3.0.6-3.el6.remi.i686                                        14/23
  Installing : php-pecl-sqlite-2.0.0-0.1.svn313074.el6.remi.i686                              15/23
  Installing : php-5.4.0-1.el6.remi.i686                                                      16/23
  Installing : php-pgsql-5.4.0-1.el6.remi.i686                                                17/23
  Installing : php-mcrypt-5.4.0-1.el6.remi.i686                                               18/23
  Installing : php-xml-5.4.0-1.el6.remi.i686                                                  19/23
  Installing : php-fpm-5.4.0-1.el6.remi.i686                                                  20/23
  Installing : php-mbstring-5.4.0-1.el6.remi.i686                                             21/23
  Installing : compat-mysql51-5.1.54-1.el6.remi.i686                                          22/23
  Cleanup    : mysql-libs-5.1.61-1.el6_2.1.i686                                               23/23

  php.i686 0:5.4.0-1.el6.remi                           php-cli.i686 0:5.4.0-1.el6.remi
  php-common.i686 0:5.4.0-1.el6.remi                    php-fpm.i686 0:5.4.0-1.el6.remi
  php-gd.i686 0:5.4.0-1.el6.remi                        php-mbstring.i686 0:5.4.0-1.el6.remi
  php-mcrypt.i686 0:5.4.0-1.el6.remi                    php-mysql.i686 0:5.4.0-1.el6.remi
  php-pdo.i686 0:5.4.0-1.el6.remi                       php-pear.noarch 1:1.9.4-7.el6.remi
  php-pecl-apc.i686 0:3.1.10-2.el6.remi                 php-pecl-memcache.i686 0:3.0.6-3.el6.remi
  php-pecl-memcached.i686 0:2.0.1-2.el6.remi            php-pecl-mongo.i686 0:1.2.10-2.el6.remi
  php-pecl-sqlite.i686 0:2.0.0-0.1.svn313074.el6.remi   php-pgsql.i686 0:5.4.0-1.el6.remi
  php-xml.i686 0:5.4.0-1.el6.remi

Dependency Installed:
  compat-mysql51.i686 0:5.1.54-1.el6.remi                   libmemcached.i686 0:1.0.4-1.el6.remi
  php-pecl-igbinary.i686 0:1.1.2-0.1.git3b8ab7e.el6.remi    t1lib.i686 0:5.1.2-6.el6_2.1

Dependency Updated:
  mysql-libs.i686 0:5.5.22-1.el6.remi


2. How to check PHP Version :

[root@centos62 ~]# php -v
PHP 5.4.0 (cli) (built: Mar  2 2012 17:49:53)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

3. Proceed to configure PHP-FPM to meet your requirement :

[root@centos62 ~]# vi /etc/php-fpm.d/www.conf

4. Start PHP-FPM :

[root@centos62 ~]# service php-fpm start
Starting php-fpm:                                          [  OK  ]


1 Comment

  • Avatar Shahzaib Cb says:

    I want to install php-fpm5.3.3 as my server is running php-5.3.3 so i can’t switch to 5.4php . I can’t fine any repo that supports php-fpm5.3.3 .Please help me

Leave a Reply

Your email address will not be published. Required fields are marked *