将 VESTACP 升级到 PHP 7 (CENTOS)

UPGRADE VESTACP TO PHP 7 (CENTOS)

Sawiyati | December 10th, 2015

How to install PHP 7 (stable) on VestaCP server running on CentOS 7 with some test results of how VestaCP + PHP 7 can perform together serving WordPress site. For your information, PHP 7 has just been released and many rumors say it can perform multiple times faster than previous stable PHP version and also as fast as HHVM. This is the most anticipated PHP version ever bringing many new features, enhancements, and improved performance.

Until the time I write this post, VestaCP is by default using PHP 5.4.x installed and running with web server (either Apache or Nginx). I’m not  really sure why its developer still pack PHP 5.4 within VestaCP installation but as far as I know PHP 5.4 is the most popular stable version after 5.3 that many scripts, web apps and CMS are supported (can still run well with the PHP environment).

As per PHP 7, there are still not enough information of how many CMS / scripts except WordPressand OwnCloud those are already PHP 7 compatible. So if you are planning to build a WordPress site with VestaCP, you can try this tutorial and feel the awesomeness of PHP 7. But I must also remind you that since VestaCP doesn’t include PHP 7 by default yet, so I recommend you to not using VestaCP + PHP 7 on production websites unless you are a sysadmin Ninja. However, with default Vesta setup (Nginx as proxy + Apache + PHP), this method still can work properly so it is safe if you’ll just want to host personal blog or few blogs inside one server.

WHAT YOU MAY NEED

  1. A SSH client like Bitvise or Putty and basic knowledge about how to use it.
  2. Basic knowledge about common Unix command to SSH to your server.
  3. A server or VPS with at least 1GB of RAM (2GB or more is recommended).
  4. Make sure your Vestacp server is installed and running on CentOS server.
  5. About 30 minutes of your time
  6. a cup of coffee or tea.

Confused on choosing which VPS provider to install VestaCP? Read my recommended VPS providers or top low end cloud server providersQuick recommendation: Digital Ocean,Atlantic.net or Ramnode.

HOW TO INSTALL

p.s: Please click any image you wish to see its larger version.

Step 1 – Install VestaCP on your vps, cloud or dedicated server. You can follow the step by step tutorial posted previously. Despite this tutorial done on CentOS 7, but the steps are pretty much similar.

Step 2 – Once installed, still in Putty, you can do initial check of what PHP version is installed:

php -v

it should look like this (PHP 5.4.45):

default-php-version.jpg

Step 3 – Now we need to install remi repo or at least make it updated. PHP 7 is considered new and is not available via Yum at base CentOS repo.

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

Also read:

How to enable Remi repository on CentOS 7, 6 and 5

Here’s I show you in screenshot pics:

install-remi-repo-vestacp-centos-7-620x333.jpg

Step 4 – Now issue this command to update and enable it

yum --enablerepo=remi update remi-release

update remi repo centos 7

update-remi-repo-centos-7-620x479.jpg

Step 5 – Now delete current PHP installation but make sure you stopped Apache first:

service httpd stop

yum -y remove php

remove php vestacp

remove-php-vestacp-620x355.jpg

Simply answer Y when asked.

Step 6 – Finally, issue this command to install PHP 7.0 with all necessary modules:

yum --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

install-php-7-on-vestacp-centos-620x330.jpg

Wait till the process finished which in my case it took about a minute or two. When finished, your screen will look like this:

php-70-installed-620x349.jpg

Step 7 – Next, at this point, you can simply stop the old PHP-fpm service and start the newly installed PHP70-fpm

service php-fpm stop

service php70-php-fpm start

It’s simply like this pic:

stop-php-fpm-vesta.jpg

Step 8 – Finally you can delete the old php symblink and create a new one:

rm /usr/bin/php

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

create-symblink.jpg

Also do not forget to restart Apache service / httpd:

service httpd restart

Step 9 – Now you can check which version of PHP Vestacp is running:

php -v

vestacp-php-70-success-620x161.jpg

Done!

You can create simple phpinfo() page to see some detailed specs:

php-70-info-620x620.jpg

See? It is running PHP 7.0 now. How cool is that!

Arnold Knegt

Read more posts by this author.

or subscribe via RSS with Feedly!
评论功能在中国大陆网络环境受限。
Due to some special reason, you're not able to access to our comment system in mainland China.