Install php 5.6 centos 8

By default the CentOS 7 official software package repositories have PHP 5.4, which has reached the end of life and no longer actively maintained by the developers. To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system.

Therefore it is strongly recommended for you to upgrade or install a latest supported stable version of PHP 5.5, PHP 5.6 or PHP 7 on a CentOS 7 Linux distribution.

In this article, we will explain how to install supported stable versions of PHP 5.5 (only security updates provided) or PHP 5.6 on CentOS 7 (same instructions also works on RHEL 7) distribution.

Installing PHP 5.6 on CentOS 7

1. To install PHP 5.6, you have to install and enable EPEL and Remi repository to your CentOS 7 system using the commands 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

2. Next, install yum-utils which is an assortment of utilities that integrate with yum to enhance its default features, giving it more advanced package management options and also making it easier to use.

A few of its important features include manipulating repositories, enabling or disabling packages on the go and lots more, without any manual configurations.

# yum install yum-utils

3. One of the most important program provided by yum-utils is yum-config-manager, which you can use to active Remi repository as the default repository for installing various PHP versions. For example, if you want to install PHP 5.5, PHP 5.6 or PHP 7.2 on CentOS 7, just enable it and install as shown.

# yum-config-manager --enable remi-php55   [Install PHP 5.5]
# yum-config-manager --enable remi-php56   [Install PHP 5.6]
# yum-config-manager --enable remi-php72   [Install PHP 7.2]

4. Now that you’ve enabled selected versions of PHP, you can install PHP (here, we have chosen to install PHP 5.6) with all needed modules as follows

# yum-config-manager --enable remi-php56   [Install PHP 5.6]
# yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Important things to note:

  1. In case you want to downgrade the PHP version for one reason or the other, you will need to remove existing PHP version(s) and then reinstall the new PHP with modules you need.
  2. You can as well install multiple versions of PHP on Linux and manually choose which version to use by default.

Afterwards, double check the installed version of PHP on your system.

# php -v

Lastly, remember to read these useful PHP articles:

  1. How to Use and Execute PHP Codes in Linux Command Line
  2. How to Find MySQL, PHP and Apache Configuration Files
  3. How to Test PHP MySQL Database Connection Using Script
  4. How to Run PHP Script as Normal User with Cron

That’s it for now! To share any thoughts with us, you can use the comment form below. Next, we will step you through installing PHP 7 in CentOS 6. Until then, stay connected to Tecmint.com.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Install php 5.6 centos 8

We are thankful for your never ending support.

Shortly after RHEL-8, CentOS 8 is released and of course my repository is already open and fully populated.

Install php 5.6 centos 8

Repository installation :

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

And, for example, to install PHP 7.3 (alternative streams)

# dnf module install php:remi-7.3
# php --version
PHP 7.3.10 (cli) (built: Sep 24 2019 12:06:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies

Notice, if you want to install various version simultaneously, the Software Collections of PHP 5.6, 7.0, 7.1, 7.2, 7.3 et 7.4 are also available.

# dnf install php56
# module load php56
# php --version
PHP 5.6.40 (cli) (built: Apr 30 2019 11:08:08) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

You can also follow the wizard detailed instructions