I need PHP 5.4 installed in an Amazon Linux instance.

Presently we have:

root@ip-10-138-1-229 webapps]$ php -version
PHP 5.3.29 (cli) (built: Aug 20 2014 16:41:34)

Is there a yum package for this?

$ yum install php-5.4
Loaded plugins: priorities, security, update-motd, upgrade-helper
Setting up Install Process
No package php-5.4 available.
Error: Nothing to do

Let us try to update yum for php:

yum update php
Dependencies Resolved

 Package                                   Arch                                 Version                                          Repository                               Size
 php                                       x86_64                               5.3.29-1.7.amzn1                                 amzn-main                               2.8 M
Updating for dependencies:
 php-bcmath                                x86_64                               5.3.29-1.7.amzn1                                 amzn-main                                52 k
 php-cli                                   x86_64                               5.3.29-1.7.amzn1                                 amzn-main                               2.6 M
 php-common                                x86_64                               5.3.29-1.7.amzn1                                 amzn-main                               1.0 M
 php-gd                                    x86_64                               5.3.29-1.7.amzn1                                 amzn-main                               219 k
 php-process                               x86_64                               5.3.29-1.7.amzn1                                 amzn-main                                66 k
 php-xml                                   x86_64                               5.3.29-1.7.amzn1                                 amzn-main                               234 k

Well that’s getting us latest/greatest php 5.3 How to get 5.4?

Maybe PHP 5.4 were not supported yet on Amazon Linux?

UPDATE : slightly updated from @vembutech answer below:

(Run as root):

yum remove httpd*
yum remove $(yum list installed | grep "php" | awk '{print $1}')
yum install httpd24 php54

Now we can use the new nifty builtin httpd server from php 5.4:

root@ip-10-138-1-229 nanoweb_2.2.6]$ php -S localhost:8000
PHP 5.4.37 Development Server started at Fri Feb 20 20:31:22 2015
Listening on http://localhost:8000
Document root is /root/nanoweb_2.2.6
Press Ctrl-C to quit.
up vote 11 down vote accepted

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

  • This worked! I have updated the OP for the results. – javadba Feb 20 '15 at 20:32

Looks like official Amazon repository does not have php higher than 5.3.

What you could do is either get the required packages in RPM form from elsewhere, or add a non-Amazon repository that carries 5.4. Quick googling suggests visiting webtatic.com

edit: should be noted that Amazon does, in fact, supply 5.4, but as "php54" package, as noted by vembutech

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.