Installing PHP 5.2 on Ubuntu Lucid Lynx (10.04 LTS)

If you followed my previous post on downgrading your PHP installation, this may be of interest to you, since the Karmic security repositories are no longer available. There may be workarounds, but I couldn’t install PHP 5.2 following my previous instructions.

Here’s a different way to do it, that proved successful. Note that the install procedures outlined below, is for a fresh install of Ubuntu Server without the LAMP package selected during installation. If you want to adapt a system with 5.2 already installed, I’m sure you can figure it out using this post for inspiration.. 😛

First, you need to install add-apt-repository (root is assumed on all commands unless otherwise stated):

apt-get install add-apt-repository

Add the following into /etc/apt/preferences.d/php to pin PHP at version 5.2:

</pre>
Package: libapache2-mod-php5
Pin: version 5.2.10*
Pin-Priority: 991

Package: libapache2-<wbr>mod-php5filter
Pin: version 5.2.10*
Pin-Priority: 991</wbr>

Package: php-pear
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-cgi
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-cli
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-common
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-curl
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-dbg
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-dev
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-gd
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-gmp
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-ldap
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-mhash
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-mysql
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-odbc
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-pgsql
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-pspell
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-recode
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-snmp
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-sqlite
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-sybase
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-tidy
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-xmlrpc
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-xsl
Pin: version 5.2.10*
Pin-Priority: 991

Package: php5-mcrypt
Pin: version 5.2.6*
Pin-Priority: 991

Package: php5-imap
Pin: version 5.2.6*
Pin-Priority: 991

Now, we’ll be using PHP 5.2 compiled for Lucid Lynx (courtesy of Ralph Janke). Add Ralphs repository:

add-apt-repository ppa:txwikinger/php5.2

Update apt:

apt-get update

Install PHP 5.2:

apt-get install php5

Install MySQL if needed:

apt-get install mysql-server mysql-client

There. You should have a LAMP server up and running with PHP 5.2, without having to worry about Karmics repositories being gone, or an accidental upgrade to 5.3.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s