Ushahidi for Ubuntu 10.4 php5.2 and Mcrypt

For a few days in my offtime i've been meaning to play with Ushahidi and the Ushahidi platform. All was going swimmingly until the installer complained about a missing php5 mcrypt module. There are a host of issues regarding php 5.3 and luckily i had already downgraded to php 5.2 on a test server, but strangely i was still getting this error.

$ sudo apt-get install php5-mcrypt
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
  php5-mcrypt: Depends: phpapi-20090626+lfs
E: Broken packages

There was no immediate answer in the first google results page, so i left it a few days and then found this gem from here (which also has thorough instructions on downgrading php 5.3).

In short, add the following to the end of /etc/apt/preferences.d/php

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991
at the bottom.

Then, as if by magic, everything started to go swimmingly.

$ sudo apt-get install php5-mcrypt
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libmcrypt4
Suggested packages:
  libmcrypt-dev mcrypt
The following NEW packages will be installed
  libmcrypt4 php5-mcrypt
0 upgraded, 2 newly installed, 0 to remove and 13 not upgraded.
Need to get 91.4kB of archives.
After this operation, 332kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get: 1 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libmcrypt4 2.5.8-3.1 [76.1kB]
Get: 2 http://gb.archive.ubuntu.com/ubuntu/ karmic/universe php5-mcrypt 5.2.6-0ubuntu2 [15.3kB]
Fetched 91.4kB in 0s (753kB/s) 
Selecting previously deselected package libmcrypt4.
(Reading database ... 146842 files and directories currently installed.)
Unpacking libmcrypt4 (from .../libmcrypt4_2.5.8-3.1_i386.deb) ...
Selecting previously deselected package php5-mcrypt.
Unpacking php5-mcrypt (from .../php5-mcrypt_5.2.6-0ubuntu2_i386.deb) ...
Processing triggers for libapache2-mod-php5 ...
Setting up libmcrypt4 (2.5.8-3.1) ...

Setting up php5-mcrypt (5.2.6-0ubuntu2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

$ php -v
PHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Now back to planning the revolution...

3 Comments

Thanks for this! I was just

Thanks for this! I was just stuck on the same issue. Using Ubuntu as my development machine, I've found switching PHP versions (and modules) between projects to really be a pain. I'm thinking in the future I might try hosting my developments in virtual machines. Thanks again, you cured my headache.

No worries man. Its a real

No worries man. Its a real pain when you use a packaging system and have to work with different version levels. I guess the best solution is to compile everything from source and softlink to each version as necessary. But thats no way to run a desktop machine

Add new comment