New to our community ?

Discover a world of possibilities! Join us and explore a vibrant community where ideas flourish and connections thrive.

One of Our Valued Members

Thank you for being part of our community. Your presence enriches our shared experiences. Let's continue this journey together!

Home CentOS How to Install PHP on CentOS

How to Install PHP on CentOS

How to Install PHP on CentOS

Welcome back to, so today we are starting a new tutorial category in our learning platform.
in our previous post we learn how to implement Razorpay payment gateway with the help of PHP.
so in this post today we will learn how to Install PHP on CentOS. before start this tutorial first of all we should take an small overview about CentOS and PHP.

install php on centos

we all know about PHP is a server side scripting language which stands for hyper text processor. mostly PHP is used from web based software, its easy to learn.
CentOS is a Community Enterprise Operating System. It is an open-source platform for non-productive developmental work.

For production concern, those works can be migrated to RHEL (Red Hat Enterprise Linux) Linux distribution platform.
so in this post we will learn to install the PHP version 5.6. which is most popular PHP version.

In our next article we see how to install PHP My Admin and MySQL in CentOS.
Let’s see some features about PHP version 5.6
Reduced Memory
due to the reuse of php://input. Numeric, String and constant have scalar expression.
A constant array can use constant keywords.
PHP 5.6 can be used for command-line scripting.
Graphical user interface application can also be used by clients.
It has advanced protection patches.

Before Installation

Please make sure that remi:repo file was enable. i.e Enable=1 (inside remi:repo file) .Next point is to check the package was having required version for installation .
Type the below command to install the rpm release packages. This will help you to install the packages of PHP version you wish to install.

yum install
yum install

Step2: now we are install utils. This will provide user with advanced package management options.
So that no manual configuration required for enabling and disabling the packages. For this, install utils command given below.

yum install yum-utils

Also Read :
How to Install MySQL in CentOS.
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

Enter Y after the utils command execution completed.
Step3 : In the next step we will be the most important program provided by utilities is configuration manager, through which the activation of ‘Remi repository’ will happen.
This will be the default manipulating repository settings provided by utilities. which is help us to install any version of PHP.

In the end of command you can see two digits, which represents the version number.Eg: 56 for PHP 5.6 , 74 for PHP 7.4Below command will enable you the selected version.

yum-config-manager –enable remi-php56

Step4: We are going to install the PHP of required version. You can use any extension from the list given below with respect to your library files.

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

Finally, To make sure that you have enabled correct version, use below command and check the version.

php -v

After Installation of PHP:

To check the installation, First you can restart your apache package, using below command.

service httpd restart