Update VestaCP to PHP 7 on CentOS 7

If you’re using, or thinking of using VestaCP then you probably already know that it doesn’t come with PHP 7 by default. With all the improvments that PHP 7 offers and with popular software such as WordPress, WHMCS and Drupal all supporting it, it’s a no brainer to upgrade.

You’ll need the Remi repository enabled to do this since PHP 7 isn’t available in the default repos, if you haven’t already got it installed then you should check out our guide on how to first (if you need to see if Remi is enabled run “sudo yum repolist” and check if EPEL and Remi is listed).

First let’s make sure your server is up to date.

sudo yum update

We’ll also check what version of PHP we have installed for reference.

php -v

Now we make sure that yum-utils is installed

sudo yum install yum-utils

If it’s already installed, great move on to the next step, if not then allow it to install.

Now we can enable remi-php70

sudo yum-config-manager --enable remi-php70
You’ll get a large output after doing this.

Now we can tell yum to update, this will upgrade our old version of PHP to 7

sudo yum update
Yum will handle all the work for us.

After the process has finished your server will now have PHP 7 installed, we need to restart our web server for it to take effect however.

If you have Apache and NGINX installed, or just Apache installed run

sudo service httpd restart

If you are running NGINX and PHP-FPM then run

sudo service php-fpm restart

Lastly we’ll check the PHP version like we did at the start

php -v

And you should see something similar to

PHP 7.0.22 (cli) (built: Aug 2 2017 09:39:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

This isn’t required but if you would like to keep your system clean then we can now disable the older versions of PHP from our system. To do this run the following

sudo yum-config-manager --disable remi-php56
sudo yum-config-manager --disable remi-php55
sudo yum-config-manager --disable remi-php56-debuginfo
sudo yum-config-manager --disable remi-php55-debuginfo
sudo yum clean all
sudo yum update

And that’s it, now you have PHP 7 running on your VestaCP install on CentOS 7

If you have any problems leave a comment and I’ll try to help out 🙂

2 thoughts on “Update VestaCP to PHP 7 on CentOS 7

  • 4th February 2018 at 9:04 PM

    Working perfectly. Nice guide!

  • 30th March 2018 at 2:42 PM

    Thank you for this tutorial. It works perfectly and it’s straight to the point.


Leave a Reply

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