Ubuntu 12.04, PHP 5.4, Apache2, and ppa:ondrej/php5

Okay, wow, what a doozy. I guess this is a lesson in why you want to be careful of the PPAs you use on your Ubuntu servers.

Summary

The very popular ppa:ondrej/php5, a Personal Package Archive for Ubuntu 12.04, upgraded from PHP 5.4 to PHP 5.5. This would require a newer version of Apache (v 2.4). If you upgraded Apache from 2.2 to 2.4, you would likely run into apache configuration issues.

If you want to continue to run PHP 5.4 instead of PHP 5.5, you can use the new PPA: ppa:ondrej/php5-oldstable

Problem

Of course it took me awhile to track down this issue because multiple things had changed on me, but yesterday my Vagrant project stopped working. When I would do a vagrant destroy and then a vagrant up I would get an error trying to install libapache2-mod-php5:


The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: apache2-api-20120211 but it is not installable
                       PreDepends: apache2 (>= 2.4)

So I checked out the PPA's page: https://launchpad.net/~ondrej/+archive/php5

I noticed it had a newer description. It took me awhile to realize it mentioned an older, more stable version. I scrolled down to see what version of php5 it had:


5.5.1+dfsg-1~precise+1

It had been updated on 2013-07-30, yesterday. So now my vagrant projects that used this PPA to install PHP 5.4 was installing PHP 5.5, it would cause libapache2-mod-php5 to break, which would cause all of my other packages and services to fail due to this dependency.

Solution

PHP 5.4

If you want to stay on PHP 5.4, you need to use the PPA ppa:ondrej/php5-oldstable.

PHP 5.5

You'll need to add the ppa:ondrej/apache2 as well to install Apache 2.4. Be warned, you might have stuff that chokes on Apache 2.4, so just be aware of that.

Final Thoughts

If you Google for "Ubuntu 12.04 PHP 5.4", you will get dozens of results saying to use ppa:ondrej/php5. However, now because you need a newer version of Apache, you'll likely get a lot of people with failed installs. This is going to be even worse if people do an aptitude upgrade and don't pay attention.

So if you know people who use Ubuntu 12.04 LTS and PHP 5.4, make sure they realize about the PPA update.

11 thoughts on “Ubuntu 12.04, PHP 5.4, Apache2, and ppa:ondrej/php5

  1. This kind of thing is the big risk you take using any repository. It comes down to trust. The official Ubuntu repos are highly trusted as they keep stable within a release branch. Other repos may also be highly trusted too.

    But this instance proves that this repository is not one to have any kind of trust in stability. To make such a major change within a single release branch (precise), especially an LTS branch… That is totally reprehensible.

    Like

  2. To be fair, I believe this PPA’s maintainers intension was to keep this bleeding edge. It was a problem with people saying “Hey, this works to make PHP 5.4 run” since Ubuntu’s official repos for 12.04 only had PHP 5.3. Just now a year later when bleeding edge is 5.5 people are now caught in an awkward place.

    So it was a problem with people using in production what should have been a developer bleeding edge repo.

    Like

  3. Hey, thanks for this article!

    Like

  4. Thank you for the article pointing to oldstable – I did exactly that, I needed to run some Behat testing which requires 5.4. Found the links for the ppa but it stuffed up my apache after installing it.

    Like

  5. Of course one shouldn’t use such PPAs on a production system. But the main problem here to me is bad naming conventions. As a maintainer, you should use names like ppa:ondrej/php5-4 or ppa:ondrej/php5-5 for your repos, instead of “stable” or oldstable which can change its meaning after a major version update.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close