Magento and Ubuntu Lucid Lynx

I’ve just had lots of fun getting Magento 1.3.2 to work nicely with Ubuntu 10.04 – the problem is with the version of PHP installed by default in Lucid Lynx. Versions of Magento under 1.4 appear to have trouble with any PHP version over 5.2.10, and Lynx ships with 5.3. So, in order to run Magento webstores from older versions, you’ll need to downgrade your PHP version. This can be done by opting to use the repositories for Karmic instead of the Lynx. Here’s a script, nabbed from this page here which will automate that for you:

#!/bin/sh

# Script to install PHP 5.2 from 9.10 on 10.04
# And pin it so it does not get updated

PKGS=`dpkg -l | grep php | awk '{print $2}'`

apt-get remove $PKGS

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

mkdir -p /etc/apt/preferences.d/

for PACKAGE in $PKGS
do
  echo "Package: $PACKAGE
Pin: release a=karmic
Pin-Priority: 991
" | tee -a /etc/apt/preferences.d/php
done

apt-get update

apt-get install $PKGS

June 16, 2010