PHP install on clean Amazon Linux AMI
Solution 1:
This is due to a limitation of RPM/YUM on Amazon Linux, and the way that the multiple versions of php are packaged. One of the features of Amazon Linux is that there are multiple versions of several languages and other opensource software packages. In many cases these packages have to conflict with one another, as the software is not designed to be installed at the same time.
In this case, what is happening is that each of the php packages has a generic provides (i.e. php php54 and php55 all provide php). The php-amazon-sdk2 just requires php, which is being met by specifying the php55 package on the yum command line. The conflict error is coming from the php-guzzle-Guzzle package, which requires php-common. In this case if you add php55-common to your yum command when installing the php-amazon-sdk2 package it will succeed.
yum install -y httpd24 php55 php55-common php-amazon-sdk2
In general, on the Amazon Linux AMI, if you get conflict errors with php, the workaround is to add the correct versioned package to the yum command line. In this case the reported conflict was php-common. You knew you wanted to install php55, so it was just a matter of telling yum exactly what you want (i.e. I want php55-common, not php-common). If you install a package that requires php, and you don't specify any other php packages, then yum will choose the generic php packages, and PHP 5.3 will be installed. These conflict errors are typically an issue with php54 and php55 packages.
I agree that this work around is not intuitive, and this issue has been noted by the Amazon Linux AMI team. They are exploring several different solutions to this issue. They are very open to feedback on php packaging and on the Amazon Linux AMI in general. They do monitor the aws forums, so that would be the best place to post issues. If you have AWS Premium Support, you can open a case with them and it will get forwarded to the Amazon Linux AMI team.
Thanks, Heath
Solution 2:
I had a similar problem involving the package php-mbstring. For those of you who are sent here by google, the solution for me was to install php55-mbstring (I had php 5.5 on my EC2 instance). Find out what version of php you have on your machine (command php -v), then append that version next to your PHP pacakge as I did above. Hopefully that will help you.