Blog

PHP7 and Vesta - Using Together

This guide explains how to install and use PHP 7 with the Vesta control panel, highlighting the performance benefits and upgrade process.

anton
PHP 7 Vesta Control Panel Server Optimization Linux Web Development

Using PHP 7 with Vesta Control Panel

The new, significantly reworked version of PHP 7 was released recently - on December 3, 2015. Although many websites still use the old, time-tested PHP 5.x, we recommend testing and running your sites on the current version of PHP. The performance increase compared to previous releases is substantial, leading to more efficient use of server resources. For comparative tests, check out the PHP 5.6 vs HHVM 3.7 vs PHP 7 Benchmarks.

To start, let’s prepare a dedicated server or SSD VDS with the Vesta control panel. We previously wrote about it on our blog - Vesta CP – Free Server Control Panel.

Installing VestaCP

We will install VestaCP in interactive, standard mode:

curl -O http://vestacp.com/pub/vst-install.sh
bash vst-install.sh

After installation, the panel will provide the admin user password – make sure to save it. The panel installs PHP version 5.4.x, which we need to upgrade to PHP 7.x using the popular REMI 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

With the REMI repository installed and activated, let’s proceed with the upgrade. Stop Apache and PHP-FPM, remove PHP 5.x, and install PHP 7.0.x:

# service httpd stop
service php-fpm stop
yum -y remove php
yum -y --enablerepo=remi-php70 install php70-php 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
rm -f /usr/bin/php
ln -s /usr/bin/php70 /usr/bin/php
service httpd restart
service php70-php-fpm start

The installation is complete! Check the version and basic PHP parameters from the command line:

[root@php7 ~]# php -v
PHP 7.0.1 (cli) (built: Dec 16 2015 14:34:32) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Done!

Now you can upload sites and start using the most modern version of PHP.

Want to start using Vesta right now?

Order any virtual server on SSD disks or dedicated server, enter the coupon VESTA-WEB-PANEL and a permanent 10% discount is in your pocket! Our technical support can assist with the installation of the panel and initial server setup. Join us!

Need Help?

Our support team is available 24/7 to assist you with any questions or issues.

Contact Support