How to yum update PHP to version 5.4 on Amazon Linux?

First you need to remove the older version and install the new version,

use the below command to remove httpd service.

sudo yum remove httpd*

Get the List of PHP packages installed using the command

sudo yum list installed | grep "php"

Remove Packages

yum remove php-cli.x86_64 php-common.x86_64 php-mysql.x86_64 php-pdo.x86_64 php-xml.x86_64

Now you can install next higher version of httpd and php using yum install command,

sudo yum install httpd24 php54