December 4, 2020
how-to-install-php7-on-centos

How to Install PHP 7 on CentOS 7

By default centos 7 repositories have PHP 5.4 which has been used long back and not yet maintained by the developers.

Inorder to secure your centos 7 system, you must install the latest repository. So to keep up with the latest features and security update you must install the latest PHP version.

So let’s get started with the installation process:

We assume that you have login as the root user, if not then make use of sudo command to acquire root privileges.

Installing PHP 7 on Centos 7

To install PHP 7 we have to enable the EPEL repository on your CentOS 7 system. To enable EPEL repository just execute the command below:-

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Next, you need install yum-utils, for managing the yum repositories and packages.

# yum install yum-utils

We will use one of the programs from yum-utils i.e yum-config-manager, which is used to enable or disable the PHP repository.

# yum-config-manager --enable remi-php70   [PHP 7.0 Version]

If you want to install PHP 7.1, 7.2 and 7.3, then just use the command to enable the repository

# yum-config-manager --enable remi-php71   [PHP 7.1 Version]
# yum-config-manager --enable remi-php72   [PHP 7.2 Version]
# yum-config-manager --enable remi-php73   [PHP 7.3 Version]

Now, let’s install PHP 7 with all the necessary modules.

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

To check if PHP is installed or not just use the command below:

# php -v
To check PHP version in Centos

In this article, we have explained how to install PHP 7 version on your centos 7 servers. Hope you all liked it 🙂

Vedant Singh

Linux System Administrator | Entrepreneur | Founder Techmion. I have started my career as a Linux system Administrator after that quit my job to start something new that excites me and started a Tech Company in order to provide the best technology to my clients. My Company website link: https://www.techmion.com/ For Bulk, SMS-Marketing follows the link : https://www.pingsms.in/

View all posts by Vedant Singh →

Leave a Reply

Your email address will not be published. Required fields are marked *