Additional PHP versions on Centos 7, Nginx & ISPConfig 3 with GCE

Currently I am using Google Cloud Platform for websites. My server (compute engine) is based on installation tutorial on  https://www.howtoforge.com/perfect-server-centos-7-x86_64-nginx-dovecot-ispconfig-3.

Unfortunately, there’s lack information on this tutorial, how to add PHP 7.0.x or PHP 7.1.x. As additional PHP versions shows in this tutorial related to Centos 6.3, which is not quite easy to adopt it to my current server Centos 7.

Actually, I do success compile the PHP 7.x version to my server. But, each time PHP release new version, I have to compile new PHP version again and again.

On the other hand, Remi has repo for PHP 7.x family, which is very handy, because i can easily update by using command ‘yum update’, without recompile it.

How to use Remi repo for additional PHP version

First, we need to add Remi repo to our system

cd /tmp
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -ivh remi-release-7.rpm

Let say, I want to add PHP 7.1.x to my system. Then run

yum install php71-php-bcmath php71-php-cli php71-php-common php71-php-fpm php71-php-gd php71-php-intl php71-php-json php71-php-mbstring php71-php-mcrypt php71-php-mysqlnd php71-php-opcache php71-php-pdo php71-php-pear php71-php-pecl-uploadprogress php71-php-pecl-zip php71-php-soap php71-php-xml php71-php-xmlrpc

Then, we have to edit /etc/opt/remi/php71/php-fpm.d/www.conf.
And change the listen port php-fpm

listen = 127.0.0.1:8999

By default php-fpm listen port would be 9000, so we need to adjust it. Please also make sure you have port different form another version of PHP.

And now, start and set as service.

systemctl start php71-php-fpm
systemctl enable php71-php-fpm

In ISPConfig 3,  Add new php versions

  • Name: PHP71
  • FastCGI tab
    Path to the PHP FCGI binary: /opt/remi/php71/root/usr/bin/php-cgi
    Path to the php.ini directory: /etc/opt/remi/php71
  • PHP-FPM tab
    Path to the PHP-FPM init script: /etc/opt/remi/php71
    Path to the PHP-FPM pool directory: /etc/opt/remi/php71/php-fpm.d

That’s it. Now we have PHP 7.1 in ISPConfig which will updated by simple command ‘yum update’.

Cheers!

Categorised in: , ,

This post was written by Sunaryo Hadi

Leave a Reply

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.