Max says…

Avatar

thoughts of a web developer

Revert to PHP 5.2 in Ubuntu 10.04 (Lucid Lynx)

Despite suppressing updates of my LAMP stack, the upgrade to Ubuntu 10.04 ignored that, and as such I now have PHP 5.3.X installed.  Ordinarilly this woud be fine, but one of the open source web applications I work with doesn’t play well with PHP 5.3.X.  I needed a simple way to revert to a previous 5.2.X version of PHP.  The version in the Ubuntu 9.10 (Karmic) repositories would do the trick, so it was jsut a case of forcing Ubuntu to honour the 9.10 versions of various PHP packages over the 10.04 versions.

First, we get a list of all the currently installed PHP packages:

sudo dpkg -l | grep php > /tmp/php.packages

Next we remove the currently installed PHP packages:

sudo apt-get remove --purge $(dpkg -l | grep php)

Now we need to create an alternative sources list:

sed s/lucid/karmic/g /etc/apt/sources.list |\
sudo tee /etc/apt/sources.list.d/karmic.list

Having done that, we need to generate an aptitude preferences file for PHP:

awk '{print "Package: " $0; print "Pin: release a=karmic\nPin-Priority: 991\n"}' /tmp/php.packages |\
sudo tee /etc/apt/preferences.d/php

This preferences file tells aptitude that for each listed package, we want to pin down the installation candidate to that from the Karmic repositories. We can now install the packages that we previously removed, but this time the versions from the Karmic repositories:

sudo apt-get install $(cat /tmp/php.packages | tr "\n" " ")

A quick restart of Apache and everything seems to be working with the older version of PHP!

UK Geocoding – Update

I’ve updated the UK Geocoding site to provide better documentation, and a UI for geocoding, in addition to the XML API.

UK Geocoding

After a little hard work, I’m releasing my attempt to address the shortfall in accurate UK geocoding services.  Courtesy of open data provided by Ordnance Survey Open Click-Point, some sed, SQLite, PHP and YQL I’ve produced a REST API, and a YQL datatable.  I’ve also written a more thorough account of this by way of documenation.

Playing With Perl Sockets

At work, I have a Snom 360 IP phone that is hooked up to our internal Asterisk PBX.  If I’m listening to music with my headphones in, I’m not always aware that my phone is ringing – some Perl and PHP hacking later, I’ve got a crude (and work-in-progress) solution. [Read more]

,