How to upgrade PHP 5.4 to 5.6 version in Centos 7

How to upgrade PHP 5.4 to 5.6 version in Centos 7 post thumbnail image

The latest version of PHP is 7.4.8. But still, some are using previous versions of 5.x. I strongly recommend you upgrade to the latest version. If you want to upgrade to 5.6 only then this article is for you.

Let’s see how to upgrade the existing PHP 5.4 to PHP 5.6 version in a simple way.

First, check your existing PHP version by using ‘-v’ option

# php -v

Output should be like this:

PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

You need to install REMI and EPEL repositories to get PHP 5.6 pakcages

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

Now enable remi repositories

vim /etc/yum.repos.d/remi.repo

[remi]
name=Remi's RPM repository for Enterprise Linux 7 - $basearch
baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
mirrorlist=https://rpms.remirepo.net/enterprise/7/remi/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/remi/mirror
<span class="has-inline-color has-vivid-red-color">enabled=1</span>
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
mirrorlist=https://rpms.remirepo.net/enterprise/7/php56/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/php56/mirror
NOTICE: common dependencies are in "remi-safe"
<span class="has-inline-color has-vivid-red-color">enabled=1</span>
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Upgrade PHP using yum upgrade command.

# yum upgrade php* -y

Now check PHP version, it should show new version of package.

# php -v
PHP 5.6.40 (cli) (built: Sep 29 2020 11:13:13)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

That’s it! We are successfully upgraded PHP.

This was the process for “How to upgrade php 5.4 to 5.6 in Centos 7”

2 thoughts on “How to upgrade PHP 5.4 to 5.6 version in Centos 7”

Leave a Reply

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

Related Post

Enable SSL on your website in UbuntuEnable SSL on your website in Ubuntu

To enable SSL on your website first you need to install SSL on your server. Install SSL Certificates 1. First edit ssl file in apache2 directory. root@Linoide:~# vim /etc/apache2/sites-available/default-ssl.conf Add these lines: <VirtualHost> ServerAdmin webmaster@localhost DocumentRoot /var/www/html Servername linoide.com Serveralias www.linoide.com </VirtualHost> Change your SSL file location on these lines