Skip to Content

How to upgrade php to 7.2 on Centos

How to upgrade PHP in centos 7?


  Enter the following commands on the terminal to upgrade php:

1. Turn on EPEL repo

root@gateway:~#  yum install epel-release

2. Turn on remi-repo

  3. Install yum-util packages

root@gateway:~#  yum install yum-utils -y

  4. Enable remi repo as per the desired php version

root@gateway:~#   yum-config-manager --enable remi-php72

root@gateway:~#   yum update

 5. Finally install php7.X  

root@gateway:~#   yum install php72


How to upgrade PHP to 7.2 on centos 6?

 We do not recommend using Centos 6 as it is no longer supported by the Linux community with security patches, vulnerabilities, or bug fixes. You can follow the instructions to migrate to a centos 7 box and upgrade PHP in centos 7 after migration.

Follow the instruction to migrate to a new Centos 7 box

1. Run the script /usr/local/sbin/backup_ezlogin.php on the current server to create the backup archive.
     The backup archive would be created in /var/ezlogin.xx.bin


2. Spin up a new Centos 7 Vm and make sure to install the exact version of the packages such as PHP, web server, PHP modules, ioncube, Mysql etc.

    Refer to the system requirements:

3. Issue a temporary license for the new VM. Contact the Ezeelogin support team to issue a temporary license for migration with your public IP of new Centos VM.

wget -qO-

4. Move the executable ezlogin.xx.bin archive to the new Centos 7 server, and execute the .bin file.

sh ezlogin.xx.bin

Follow the on-screen instructions.

5. You can migrate your production license to the new centos7 box after confirming that everything working on your new machine. You can contact the ezeelogin support team for license migration.

6. You can follow the above instructions to upgrade PHP on Centos 7 and upgrade to PHP version to the latest version.


 How to upgrade PHP in amazon-linux?

1.  Install the amazon-linux-extras package 

[ec2-user:]$  sudo yum install -y amazon-linux-extras

 2. Confirm that PHP 7.x  is available in our Amazon Linux 2 machine

[ec2-user:]$  sudo amazon-linux-extras | grep php

 3. Enable php7.4 by running the following command: 

[ec2-user:]$  sudo amazon-linux-extras enable php7.4

 4. Install PHP packages from the repository.

[ec2-user:]$  sudo yum clean metadata

[ec2-user:]$   sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}

 5. Confirm the PHP Version

[ec2-user:]$  php -v 

PHP 7.4.5 (cli) (built: Apr 23 2020 00:10:21) ( NTS )
Copyright (c) The PHP Group 
Zend Engine v3.4.0, Copyright (c) Zend Technologies