Install PHP 7 on CentOS 7

PHP7-centosPHP is a server-side scripting language used for web development. Recently, the PHP development team announced that the major PHP 7 series has been released and it will become available to the web developers. In this tutorial, we will show you how to install PHP 7 on a Linux VPS.

PHP 7 comes with numerous new and improved features. One of the most noticeable is the new Zend Engine version. Also, other important improvements are the enhanced performance and significantly reduced memory usage. Thus, PHP 7 can be up to twice as fast as PHP 5.6.

To install PHP 7 on an CentOS VPS, you need to login to your server via SSH. Once you are logged in, update all your system software to the latest version using the command below:

yum update

Once the update of your system is completed, you can go ahead and add the required repositories to yum.

rpm -Uvh
rpm -Uvh

Now, install PHP 7 using the following command:

yum install php70w

The installation should take a few moments. Once it is completed, you can ensure that the latest stable release of PHP 7 is installed on your system by using the command:

php -v

You should see something like this:

PHP 7.0.0 (cli) (built: Dec  2 2015 20:42:32) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

If you like to search all the available PHP 7 modules you can use to command:

yum search php70w

To install specific PHP 7 modules like the module that allows PHP applications to use MySQL databases, you can use the command below:

yum install php70w-mysql

To test the functionality of PHP 7 on your CentOS VPS you can create a simple PHP info file and place it in your web server’s document root. Navigate to your web server’s document root:

cd /var/www/html/

Create a PHP info file using nano:

nano info.php

Paste the following content into that file:


Save the file and close it. Also, change the ownership of the file and make Apache the owner of that file:

chown apache: info.php

Do not forget to restart your Apache web server if you haven’t restarted it yet so the installation changes can take effect:

systemctl restart httpd

The last thing is to access the file using a web browser. Open your favorite web browser and navigate to the following address:

Of course, we are using the IP address for testing purposes only, so you should make sure that you are using your actual server’s IP address. You should see a page with the current PHP information such as version, compilation options, extensions, loaded configuration files etc.

Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install PHP 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How to install the latest versions of node.js and Bower on Ubuntu 13.10
Install sabre/katana on a CentOS 7 VPS
How to secure your SSH using two-step authentication on CentOS 6
There are currently no comments.

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now