PHP7 and Vesta – easy setup
PHP7 a new and significantly revised version of most popular web language received the status of the release at December 3, 2015. Yes, we know that most of websites using the old, time-proven PHP5.x, but we strongly recommend you start testing and use most recent versions of PHP (as well as other applications and operating system). There are many reasons why it is worth to do, at least a significant performance improvements over previous releases of PHP. There is number of benchmarks, such as PHP 5.6 vs HHVM 3.7 vs PHP 7 Benchmarks. Please check, good comparison test.
So, let’s setup our dedicated server or SSD VDS with extremely popular and free Vesta Control panel. Order a server or SSD VDS with Centos 7 operating system. Typically setup done within 10-15 minutes. Then login to server using SSH and let’s start.
First step – install Vesta CP. It’s easy – we need to download installation script, run it and answer for few questions:
1 2 |
curl -O http://vestacp.com/pub/vst-install.sh bash vst-install.sh |
Wait until installation ends – it’s takes about 5-10 minutes. Write down somewhere generated admin password – you will need this one later. Vesta comes by default with “time-proven” PHP 5.4.x., so we need to perform upgrade to PHP7. We will add additional repository REMI. Please paste following commands to your shell:
1 2 3 4 |
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 |
Great, we have REMI for Centos7 installed. Last and final step – let’s replace our old PHP with new one. We need to stop Apache and PHP-FPM, remove old PHP and then install new one:
1 2 3 4 5 6 7 8 |
# 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 |
It’s done. Now you can check your PHP version from command line using php -v:
1 2 3 4 5 |
[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 |
That’s all! Your new server ready to use with PHP7 onboard. Login to your Vesta Control panel, create new virtual host and upload CMS files – as usual.