Unmet dependencies after downgrading PHP 5.4 to 5.3

Von in linux, php

Not long ago I made a big mista­ke. I set up Ubun­tu 12.10 for a pro­ject requi­ring PHP 5.3. It didn’t take long in com­ing to rea­li­ze I had to down­gra­de PHP from ver­si­on 5.4.6 to ver­si­on 5.3.10. A hard road. But I scored a suc­cess and the pro­ject worked like a charm. Until I had to deploy ano­t­her modu­le, for me it was curl (but it could be pear, mycrypt, phpmy­ad­min or some­thing else just as well). Any instal­la­ti­on fai­led with unse­xy messa­ges like

root@example:/#The fol­lo­wing packa­ges have unmet depen­den­ci­es:
php5 : Depends: libapache2-​mod-​php5 (>= 5.4.6-1ubuntu1.1) but 5.3.10-1ubuntu3 is to be instal­led or
libapache2-​mod-​php5filter (>= 5.4.6-1ubuntu1.1) but it is not going to be instal­led or
php5-​cgi (>= 5.4.6-1ubuntu1.1) but it is not going to be instal­led or
php5-​fpm (>= 5.4.6-1ubuntu1.1) but it is not going to be instal­led
Depends: php5-​common (>= 5.4.6-1ubuntu1.1) but 5.3.10-1ubuntu3 is to be instal­led
[…]
E: Unab­le to cor­rect pro­blems, you have held bro­ken packa­ges.

This looks like very big head­a­che. But it isn’t. For­tu­n­a­te­ly the solu­ti­on is just around the cor­ner.

Apti­tu­de keeps its php5 pre­fe­ren­ces at the loca­ti­on:

root@example:#cd /etc/apt/preferences.d/

Let’s have a look into that con­fi­gu­ra­ti­on file:

root@example:/etc/apt/preferences.d# cat php5_3 

Package: kdevelop-php-docs-l10n
Pin: release a=precise
Pin-Priority: 991

Package: kdevelop-php-l10n
Pin: release a=precise
Pin-Priority: 991

Package: libapache2-mod-php5
Pin: release a=precise
Pin-Priority: 991

Package: php5-cli
Pin: release a=precise
Pin-Priority: 991

[...]

As you can see this defi­nes a dif­fe­rent release for modu­les than the dis­tri­bu­ti­on airs on. Just ensu­re that the desi­red modu­le is listed in this con­fi­gu­ra­ti­on, add it if necessa­ry:

Package: php5-curl
Pin: release a=precise
Pin-Priority: 991

Don’t for­get to update apti­tu­de (respec­tively packa­ge lists) after making any chan­ges to that file!

root@example:#/apt-get update
root@example:#/apt-get install php5-curl
Share on LinkedInShare on Redditshare on TumblrShare on StumbleUponDigg thisShare on FacebookGoogle+Tweet about this on TwitterEmail to someone