Upgrade VestaCP to PHP 7 (CentOS)
| |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 WordPress and 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
- A SSH client like Bitvise or Putty and basic knowledge about how to use it.
- Basic knowledge about common Unix command to SSH to your server.
- A server or VPS with at least 1GB of RAM (2GB or more is recommended).
- Make sure your Vestacp server is installed and running on CentOS server.
- About 30 minutes of your time
- 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 providers. Quick 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):
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:
Step 4 – Now issue this command to update and enable it
yum --enablerepo=remi update remi-release
Step 5 – Now delete current PHP installation but make sure you stopped Apache first:
service httpd stop yum -y remove php
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
Wait till the process finished which in my case it took about a minute or two. When finished, your screen will look like this:
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:
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
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
Done!
You can create simple phpinfo() page to see some detailed specs:
See? It is running PHP 7.0 now. How cool is that!
You can watch all steps above in my video to make sure you understand and be confident in following the steps.
What’s in the video:
- How to create CentOS 7 cloud server in Digital Ocean
- How to install Vestacp
- Some basic Vestacp configuration
- How to upgrade PHP to PHP 70 latest stable build.
- How to create database
- How to install WordPress
WATCH OR DOWNLOAD THE VIDEO HERE
password: servermom
PHP 7.0 Performance Test
I installed Vestacp + PHP 7.0 in a sub directory, installed WordPress (v4.4) using Twenty Sixteen theme, and uploaded a full of dummy content on it (dummy content credits to WPTest.io). I used Digital Ocean droplet with 1GB of RAM + 1 processor core running CentOS 7.1 x64. The test done using free account of several server speed test services including Loader.io, Blitz.io and LoadImpact.com.
GTMetrix Performance Test
Pingdom Speed Test
LoadImpact.com
Test #1: 25 unique users for 5 minutes duration:
Test #2: 50 unique users for 5 minutes duration:
Test #3: Test for50 unique users for 5 minutes duration of a blog’s page with many images:
BlazeMeter.com
A 15-minute test with 20 UVs on homepage / index page
Loader.io
Test #1: Clients per second test model with 10 clients per second over 1 minute duration (or equal with 864,000 unique visitors per day)
Result: The server can operate and serve request normally at that level of test while average response time is 1299 ms with 363 ms minimal and 2402 ms max.
Test #2: Clients per second test model with 25 clients per second over 1 minute duration (or equal with 2,160,000 unique visitors per day):
Result: The server still did not crash but it started delivering 500 error code (Internal Server Error). Average response time is 1407 ms with 11 ms min and 4565 max.
Final word about the test above, you can watch the video of each test for detailed information about how my test box with PHP 7 performed during test while after that you can conclude it yourself.
Hi. Cool tutorial, thanks! But do you know, is there a possibility to install and use two php-versions (5.6 and 7.0) at the same time for different sites? For example, use php 7.0 for WP and 5.6 for othes CMS? Nginx + PHP-FPM way are preferred.
Thank you.
there is always possibility to do that but it may need advanced tweaks and configs
heck yes! Followed your commands and it executed flawlessly! I don’t know how many people this will help since it is the bleeding edge of php and vesta. People are going to stick with what they know, but this certainly helped me!
woot woot!
[root@server1 ~]# php -v
PHP 7.0.0 (cli) (built: Dec 1 2015 16:06:41) ( 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
perhaps I celebrated a bit too early. nginx won’t start now. any ideas?
# service nginx start
Redirecting to /bin/systemctl start nginx.service
Job for nginx.service failed. See ‘systemctl status nginx.service’ and ‘journalctl -xn’ for details.
what’s in the log file said?
All is good. Server reboot seems to have fixed it. Thanks again for the tutorial!
Bunda,
Maaf newbie, baru install vps dengan centos ditambah vestacp dan terpasang 1 domain yang sudah register. Ceritanya mau bikin web hosting (padahal untuk hosting sendiri, kebetulan saya pengen punya beberapa situs, daripada hosting di tempat lain, mendingan hosting di vps sendiri).
Bagaimana caranya agar saya bisa hosting beberapa hosting di vestacp? adakah tutorialnya?
——————————————————————–
Mom,
I am a newbie, I have just setup my vps using centos 6.7 and vestacp. How to build multi site in my vesta?
Thank You.
Tentu bisa donk. Vestacp kan multisite dan multiuser layaknya WHM/cPanel, bisa punya banyak user dan tiap user bisa punya banyak websites juga bisa atur paket hostingnya
Bu boleh minta bantuan
setelah
yum –enablerepo=remi update remi-release
ada error
Error: xz compression not available
Saya pake CentOS 6.7 OpenVPZ
Hey, awesome post you did here, can you make a post how to upgrade to php 7 with froxlor(debian 8)? Also what do you think is the best, vestacp or froxlor? Thank you!
I am trying to upgrade on my dedicated server (centos 6.7). But i am getting so many issues. Could you please post php 7 upgrade on centos 6.7 in a new post.
What kind of issue (more specifically)? I can’t promise you but I’ll try
first, thanks for to tutorial…. now i have PHP 7
but after this, my roundube mail is not working 🙁
any ideas ?
Yes, I got the same issue. When perform the “step 5” , the command “yum -y remove php” will also remove roundcubemail!
Is it possible to keep roundcubemail untouched when removing php 5.6?
Thank you.
after update all my site’s not working please help
totally blank mam please help
I had tested Vestacp with PHP 7 and the sendmail from wordpress didn’t work even if I use smtp plugin. The stable php is 5.5 for me.
That’s weird, but it might happen because Vestacp is not actually supporting PHP 7 yet.
Hello Servermom,
I installed PHP7 on Vestacp server, But I am getting problem of “Server error 500” whenver I add a new post, though new post gets added.
Also I was using simplehtmldom for scraping, But it is not working now. It also shows “Server error 500”.
Please tell me why this problem is coming. Also please publish steps to downgrade from PHP 7 to default PHP 5.4.45 (VestaCP).. This is very important. Please take it on priority basis.
Vestacp is not developed or built to support PHP7 yet so you may expect errors
hello
when I install centos7 and vestacp; net2ftp cannot install.is it public or I cant install it?
and please explain about editting php.ini on php7 on centos7. I edit it but limitation of upload file remained and I came back to centos6, php5.5 because off this articles.thanks for your exellent site.
Hi, Is there a way to downgrade php7 to php5.6 on centos 7?
If so could you please post the steps. Thank you.
Servermon is a hub of great tutorials and articles for us that love dealing with hosting services, but this kind of post is sometimes trashy, indeed harmful. VestaCP won’t work properly with PHP7, if you show how to upgrade you must make sure your techinique will work.
After installing PHP7 following your steps Roundcube stops working for example.
VestaCP works properly with PHP7 but several thirdparty software included in it are not confirmed yet being compatible with PHP7. That’s way I warned readers in my introductory paragraph (see paragraph 3rd).
yea… I wish I read your comment before proceed the PHP upgrade…
Do you know the location of php.ini for php 7 in Centos 7? used to be in /etc/php.ini
I need to edit to increase import size to
upload_max_filesize = 100M
post_max_size = 100M
I know this is late but i also needed this. The function php_ini_loaded_file() returns the path to the loaded php.ini so you could create a dummy script and run it.
I followed this tutorial and mine was at /etc/opt/remi/php70/php.ini
I got proplem
“Call to undefined function mcrypt_module_open()”
Could you please show me how to enable mcrypt module?
I’m in the same situation, can’t enable Mcrypt module, is installed but not load.
Well, this was absolutely awesome. After running through this and getting PHP 7 installed, my 1GB/1vCPU VPS tested a lot better. One of the tests took the TTFB from 160ms to 73ms, with a total time of 0.7s.
Hi Sawiyati, first of all congrats for the blog is very useful to people like me with and I use to read everything you posted. I upgraded php version and all works fine, now I am following your Pydio tutorial but I can’t enable Mcrypt module, is installed but it’s impossible to load, I search around the Internet for a solution but I can’t fix it. Ty very much for your help in advance. Best wishes from Barcelona