Upgrading PHP to PHP7.0 in a CentOS server with Vesta CP

Latest VestaCP comes with PHP5.6 by default. In this article, we will see how to upgrade PHP to it’s latest version, i.e PHP7.0

First, we need to add the correct REMI repository and enable remi update, remi release and remi-php70 repository. Here’s how

[code lang=shell]
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

yum –enablerepo=remi update remi-release
yum –enablerepo=remi-php70

Now stop apache2 and remove the existing php package that comes with VestaCP

[code lang=shell]
service httpd stop
yum -y remove php

Now install PHP 7.0

[code lang=shell]
yum install php70-php
yum install php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring

After this step, all you need to do is stop the old php-fpm service and start the new one

[code lang=shell]
service php-fpm stop
service php70-php-fpm start

At some point, you may also want to create a global alias ‘php’ to run php70 cli, like this

[code lang=shell]
ln -s /usr/bin/php70 /usr/bin/php

And you’re done 🙂


  1. I got this line off of hack (hhvm) installation on debian:
    sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
    It seems to work better than symlinking manually and debian recommends it

    so, maybe change the symlink command to this:

    sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/php70 60

Leave a comment

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