Compile php-5.6 with fpm support

This entry is part 3 of 5 in the series: How to compile PHP from the source code

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 Comments

  1. Krzysztof

    Hi!

    Please make update inside your php-build.sh

    in 65 line (in last elase) should be:

    SYSCONFIDIR=$PREFIX/etc/php

    Reply
    1. Krzysztof

      If someone will try usine scrpt in Centos 6.5 php 5.6.x should make one more change.

      MAIN_CONF=”–with-apxs2=$(which apxs)” – instead (which apxs2)

      Regards 🙂

      Reply
      1. sedlav (Post author)

        Thanks for your suggestion please could you clone the script and apply the change on: https://github.com/yoander/sysadmin/blob/master/shscript/php-build.sh and do a pull request?

        Reply
  2. Krzysztof

    If someone will try usine scrpt in Centos 6.5 php 5.6.x should make one more change.

    MAIN_CONF=”–with-apxs2=$(which apxs)” – instead (which apxs2)

    Regards 🙂

    Reply
    1. Krzysztof

      Alright, one more fix 😉

      At the end of ESSENTIAL_EXT=”… add $ESSENTIAL_EXT”

      Reply

Leave a Comment

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