Compile php-5.6 with fpm support

Español English

PHP
On August 28 the PHP development team released version 5.6 which includes innovative features such as: functions with arguments variable using the operator , exponentiation operations by making use of the operator **, import functions and constants using the use keyword among others. Today LibreByte will show as compiling php-5.6 with fpm support.

Download PHP 5.6.0

$ wget http://us1.php.net/distributions/php-5.6.0.tar.xz

Unpack PHP 5.6.0

$ tar xJvf php-5.6.0.tar.xz

Download and run the script to install dependencies

$ wget -c --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-dev-install-dep.sh && 
    chmod a+x -c php-dev-install-dep.sh && 
    ./php-dev-install-dep.sh nginx

Download script to compile php

$ wget -c --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-build.sh && 
chmod a+x -c php-build.sh

Compile php with fpm support

$ ./php-build.sh -f php-5.6.0

Install

$ cd php-5.6.0 && sudo make install

Create php configuration file

Development

$ sudo cp -v php.ini-development /etc/php/php.ini

Production

$ sudo cp -v php.ini-production /etc/php/php.ini

Activate OpCache

$ sudo bash -c 'echo "zend_extension=opcache.so" > /etc/php/conf.d/20-opcache.ini'

Create fpm configuration file

$ sudo cp -pv /etc/php/php-fpm.conf.default /etc/php/php-fpm.conf

Create the fpm service startup file

sudo bash -c 'cp -v sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm &&  chmod a+x -c /etc/init.d/php-fpm'

Start the fpm service

$ sudo service fpm-start

Edit the nginx configuration file

$ sudo vim /etc/nginx/sites-enabled/default

and uncomment the following lines

location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php
    include fastcgi_params;
}

Start nginx

sudo service ngnix start

We check

$ firefox http://localhost/info.php

5 thoughts on “Compile php-5.6 with fpm support”

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.