Updating PHP version on VPS with VestaCP panel

Guidelines for upgrading the PHP version on a server with a Vesta panel

PHP5.6 is installed by default in the VestaCP control panel.

To upgrade to 7.0 on CentOS 7, you need to add the correct REMI repository and enable remi update, remi release and remi-php70 repository.

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 you need to stop apache2 and remove the existing PHP package

service httpd stop
yum -y remove php

Install PHP 7.0

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-phpphp-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, you need to stop the old PHP-FPM service and start the new one.

service php-fpm stop
service php70-php-fpm start
service httpd restart

Create a symbolic link to the new PHP

ln -s /usr/bin/php70 /usr/bin/php

You can check the version and main parameters of PHP by using the command:

# php -v

Important. Updating the PHP version may affect existing projects and they may not work correctly.

Need help?Our engineers will help you free of charge with any question in minutesContact us