How-to Tutorials

How to install PHP 5.6 on Amazon Linux 2

This method uses the "IUS" community repository at 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

Now you can install the IUS repository.

sudo yum install –y

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


  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


  2. Tiago July 17, 2020

    Hi, have a new repo url for:

    sudo yum install –enablerepo=ius-archive

    In amzlx2 I need this on command:

© 2023 linux bucket

All rights reserved