Blog

After installing CentOS 7 and the newest version of Plesk 12 i discovered that the PHP version on my website 5.6.15 was different from the PHP CLI version 5.4.16.

To display a list of installed PHP packages:

yum list installed | grep --color=auto php
php.x86_64                   5.4.45-3.el7.remi               @remi              
php-cli.x86_64               5.4.45-3.el7.remi               @remi              
php-common.x86_64            5.4.45-3.el7.remi               @remi              
php-fpm.x86_64               5.4.45-3.el7.remi               @remi              
php-gd.x86_64                5.4.45-3.el7.remi               @remi              
php-imap.x86_64              5.4.45-3.el7.remi               @remi              
php-ioncube-loader.x86_64    5.0.19-1.el7.remi.5.4           @remi              
php-mbstring.x86_64          5.4.45-3.el7.remi               @remi              
php-mysql.x86_64             5.4.45-3.el7.remi               @remi              
php-pdo.x86_64               5.4.45-3.el7.remi               @remi              
php-xml.x86_64               5.4.45-3.el7.remi               @remi                    
plesk-php56.x86_64           5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-bcmath.x86_64    5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-cli.x86_64       5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-dba.x86_64       5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-enchant.x86_64   5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-fpm.x86_64       5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-gd.x86_64        5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-imagick.x86_64   3.1.2-centos7.15100513          @PHP_5_6_15-dist   
plesk-php56-imap.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-intl.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-ioncube-loader.x86_64
plesk-php56-ldap.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-mbstring.x86_64  5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-mcrypt.x86_64    5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-mysql.x86_64     5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-odbc.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-opcache.x86_64   5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-pdo.x86_64       5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-pear.noarch      1.9.4-centos7.15120116          @plesk-php-5.6     
plesk-php56-pgsql.x86_64     5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-process.x86_64   5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-pspell.x86_64    5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-redis.x86_64     2.2.5-centos7.15100513          @PHP_5_6_15-dist   
plesk-php56-release.x86_64   5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-snmp.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-soap.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-tidy.x86_64      5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-xdebug.x86_64    2.2.3-centos7.15100513          @PHP_5_6_15-dist   
plesk-php56-xml.x86_64       5.6.16-centos7.15120116         @plesk-php-5.6     
plesk-php56-xmlrpc.x86_64    5.6.16-centos7.15120116         @plesk-php-5.6     
psa-phpmyadmin.noarch        4.5.1-cos7.build1205151118.13   @PLESK_12_5_30-dist
psa-phppgadmin.noarch        5.1-cos7.build1205150720.14     @PLESK_12_5_30-dist

Install the php5.6 packages using the remi repository:

yum install epel-release
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
nano /etc/yum.repos.d/remi.repo

Set enabled=1 for remi-php56:

[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
yum update php

Check if the new PHP packages are installed:

yum list installed | grep --color=auto php

The same list as above should be displayed including the packages below:

php56.x86_64                 2.1-2.el7.remi                  @remi              
php56-php-cli.x86_64         5.6.17-1.el7.remi               @remi              
php56-php-common.x86_64      5.6.17-1.el7.remi               @remi              
php56-php-fpm.x86_64         5.6.17-1.el7.remi               @remi              
php56-php-gd.x86_64          5.6.17-1.el7.remi               @remi              
php56-php-imap.x86_64        5.6.17-1.el7.remi               @remi              
php56-php-ioncube-loader.x86_64
php56-php-mbstring.x86_64    5.6.17-1.el7.remi               @remi              
php56-php-mysqlnd.x86_64     5.6.17-1.el7.remi               @remi              
php56-php-pdo.x86_64         5.6.17-1.el7.remi               @remi              
php56-php-pear.noarch        1:1.10.1-1.el7.remi             @remi              
php56-php-pecl-jsonc.x86_64  1.3.9-1.el7.remi                @remi              
php56-php-pecl-zip.x86_64    1.13.1-1.el7.remi               @remi              
php56-php-process.x86_64     5.6.17-1.el7.remi               @remi              
php56-php-xml.x86_64         5.6.17-1.el7.remi               @remi              
php56-runtime.x86_64         2.1-2.el7.remi                  @remi

Check if the PHP CLI has been updated:

php -v
PHP 5.6.17 (cli) (built: Jan  6 2016 18:56:36) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.12, Copyright (c) 2002-2015, by ionCube Ltd.

The following error may occur:

This wil tell you wich PHP is used:

ls -la /usr/bin/ | grep 'php'
lrwxrwxrwx.   1 root root          32 10 jan 22:06 php56 -> /opt/remi/php56/root/usr/bin/php
lrwxrwxrwx.   1 root root          36 10 jan 22:06 php56-cgi -> /opt/remi/php56/root/usr/bin/php-cgi
lrwxrwxrwx.   1 root root          33 10 jan 22:11 php56-pear -> /opt/remi/php56/root/usr/bin/pear
lrwxrwxrwx.   1 root root          38 10 jan 22:06 php56-phar -> /opt/remi/php56/root/usr/bin/phar.phar

Set the correct PHP source:

source /opt/remi/php56/enable
Zoeken