How-to Tutorials

How to install PHP 5.6 on Amazon Linux 2

This method uses the “IUS” community repository at https://ius.io/ for CentOS 7. Make sure to run a yum update and install the epel-release repo to handle dependencies if you do not already have it installed.

sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Now you can install the IUS repository.

sudo yum install –y https://centos7.iuscommunity.org/ius-release.rpm

When you install packages they need to be referenced as php56u instead of php56. Below are some example packages available for install.

sudo yum install php56u php56u-opcache php56u-xml php56u-mcrypt\
php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring\
php56u-bcmath php56u-soap

You can refer to this link to find out more about the specific php version of the php56u package that IUS is offering.

Next Post

Previous Post

2 Comments

  1. Ela April 3, 2020

    It is not working in EC2 Linux 2

    Can advise?

    I tried to install yum install php56u….

    It throwing error that not available the repository

    Thanks

  2. Tiago July 17, 2020

    Hi, have a new repo url for:

    sudo yum install –enablerepo=ius-archive https://repo.ius.io/ius-release-el7.rpm

    In amzlx2 I need this on command:
    –enablerepo=ius-archive

Leave a Reply

© 2021 linux bucket

All rights reserved