How to Install PHP 7 in CentOS 6



  1. To install latest PHP 7, you need to add EPEL and Remi repository to your CentOS 6 system like so.


yum install

yum install


  1. Now install yum-utils, a group of useful tools that enhance yum’s default package management features.Yum-utils can be used for manipulating package repositories and additional package management operations such as enabling or disabling packages without any manual configuration by a system administrator.

yum install yum-utils


  1. In this step, you need to enable Remi repository using yum-config-manager utility, as the default repository for installing PHP.


yum-config-manager --enable remi-php70   [Install PHP 7.0]


If you want to install PHP 7.1 or PHP 7.2 on CentOS 6, just enable it as shown.


yum-config-manager --enable remi-php71   [Install PHP 7.1]

yum-config-manager --enable remi-php72   [Install PHP 7.2] 


  1. Then finally install PHP 7 on CentOS 6 with all necessary PHP modules using the following command.

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo


To check the installed version of PHP on your system run php -V.

Was this article helpful?
0 out of 0 found this helpful

Have more questions? Contact our support instantly via Live Chat