Installing PHP 5.6 on Amazon Linux

Amazon Linux includes PHP 5.3 as a default. Below are the steps that can be used to update PHP version from 5.3 to 5.6 in Amazon Linux

For ease of use, we recommend switching to root privileges, to avoid repeatedly type sudo before every command. After connecting with SSH, you may switch to root as follows:
sudo su

Follow the further steps as given below:

1) Remove OLD Apache

service httpd stop
yum erase httpd httpd-tools apr apr-util

2) Remove OLD PHP

yum remove php-*
3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)

yum install php56
4) Make sure all the required PHP extensions are installed

yum list installed | grep php
5) If not then install them using

yum install php56-xml php56-xmlrpc php56-soap php56-gd
6) To list the other available php extensions

yum search php56
7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)

yum install php56-mysqlnd
(NOTE: it is not php56-mysql)

8) Start / Restart Apache

service httpd start
service httpd restart

9) Check the version

php -v
httpd -v

Your PHP installation is now completed!