December 10, 2024
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 Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh