install php-fpm from source on centos

Revision as of 06:44, 10 March 2016 by Admin (talk | contribs) (Install PHP 5.x Latest)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


During PHP install, i had to install following dependency with yum. You may need more depending on what modules you have already installed. If configure fail with error, install devel package for that module.

yum install curl-devel \
libmcrypt-devel \
libtidy-devel \
libxml2-devel libjpeg-devel \
libpng-devel zlib-devel freetype-devel \
gd-devel mhash-devel libmcrypt-devel

Install PHP 5.x Latest

Latest PHP version as on 23-Dec-2015

cd /usr/local/src
wget -O php-5.5.30.tar.gz
tar xf php-5.5.30.tar.gz

install imap for php, then

cd /usr/local/src/php-5.5.30
make clean && make distclean
./configure --prefix=/usr/local/php-fpm \
--with-config-file-path=/usr/local/php-fpm/etc \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--enable-cgi \
--with-zlib \
--with-gettext \
--enable-ftp \
--enable-calendar \
--enable-bcmath \
--enable-sockets \
--with-curl \
--with-gd \
--with-jpeg-dir=/usr/local \
--enable-mbstring \
--with-freetype-dir=/usr/local \
--with-mhash=/usr/local --enable-exif \
--with-mcrypt=/usr \
--with-tidy \
--with-openssl \
--enable-zip \
--with-imap-ssl \
--with-imap \
--with-kerberos \
--enable-fpm \
make && make install

php fpm install confirmation

Copy Configuration Files

cp /usr/local/php-fpm/etc/php-fpm.conf.default /usr/local/php-fpm/etc/php-fpm.conf
cp php.ini-development /usr/local/php-fpm/etc/php.ini
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

Running PHP-FPM

Ngnix Configuration

Use Socket Instead of TCP Port

It is better to use sockets instead of TCP port to run php-fpm.

vi /usr/local/php-fpm/etc/php-fpm.conf


listen =

Replace With

listen = /var/run/php-fpm.sock

In your nginx.conf

vi /etc/nginx/nginx.conf



Replace With

fastcgi_pass  unix:/var/run/php-fpm.sock;


php fpm