Install PHP 5.6 on Amazon Linux 2

Today we will install PHP 5.6 on Amazon Linux 2 OS.

Step 1: First we need to install the dependencies:

1 > sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
2
3 > wget https://repo.ius.io/ius-release-el7.rpm
4
5 > sudo rpm -Uvh ius-release*.rpm

Step 2: So all dependencies are installed, now we have to update all packages:

1> sudo yum update -y

Step 3: Now you have start installing the php5.6 packages:

1> sudo yum install --enablerepo=ius-archive php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath php56u-soap

Step 4: Verify PHP version:

1> [root@ip-172-31-90-192 html]# php --version
2PHP 5.6.40 (cli) (built: Jan 11 2019 10:27:04)
3Copyright (c) 1997-2016 The PHP Group
4Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
5   with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Extra:

To Install php module:

1> yum install --enablerepo=ius-archive php56u-{Module_Name}

To Validate the module name

1> php -m
2> php -m | grep {Module_Name}

I :heart: AWS! :smile: Enjoy