5

I'm trying to get a script working to bring up new Amazon Linux EC2 instances with php55 and the Amazon PHP sdk. However, I'm running into a problem that I think is caused by PHP version conflicts. I think there's something I'm missing about how yum works in this case.

To boil it down to the simplest case, if I run:

yum install -y httpd24 php55 php-amazon-sdk2

I get "Error: php55-common conflicts with php-common-5.3.29-1.7.amzn1.x86_64"

However, if I run:

yum install -y httpd24 php55

And then separately run:

yum install -y php-amazon-sdk2

It works just fine. To be clear, there's no version of PHP present on the system at all when I am running these commands, so it's not conflicting with something that's already there.

I'm not very familiar with how yum dependencies work, but it seems like this is indicating that php-amazon-sdk2 is fine with php55, but for some reason it's trying to force php53 if I install it all at the same time. What is the proper way to fix this (meaning, I don't want to just force it to install, ignoring dependencies, but I also don't want to have to do these in separate steps)?

2
  • You're really better off using Composer to manage the PHP Amazon SDK anyways. I wouldn't leave it up to Yum.
    – ceejayoz
    Sep 28, 2014 at 19:01
  • What happens if you reverse the list of packages to install? i.e; yum install -y php-amazon-sdk2 php55 httpd24 -- However I agree with @ceejayoz that you should use composer to manage this dependency as opposed to the yum repos.
    – dannosaur
    Sep 28, 2014 at 20:01

2 Answers 2

8

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

1
  • 3
    Damned good first answer. Welcome to the site!
    – ceejayoz
    Oct 3, 2014 at 17:30
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .