15

I have just installed a 10.04 LTS on my development server but the system that I need to run on it (Magento ecommerce) is not compatible with PHP 5.3 which ships with the newest version of Ubuntu. Is there a safe and upgrade-proof way of getting PHP 5.2 installed or will it be easier to use an older version of Ubuntu?

4 Answers 4

10

You can use my ppa, that I have created for this purpose. Please take notice of the pinning that is necessary. Also, aptitude will not recognize the pinning. You must use the aptitude specific method if you want to use it.

Note - this is for 10.04 (lucid) only

7
  • 1
    Where is your PPA? Jul 28, 2010 at 20:08
  • Sorry.. I am not so fast :D launchpad.net/~txwikinger/+archive/php5.2
    – txwikinger
    Jul 28, 2010 at 20:10
  • Could you also explain what I should do with this ppa?
    – silvo
    Jul 30, 2010 at 18:23
  • @silvo: you need to add the ppa to your sources lists, either by using your package manager or using add-apt-repository on the commandline. The details for the ppa are on the website of the ppa.
    – txwikinger
    Jul 30, 2010 at 20:09
  • This is pretty much the perfect answer, thanks. For those unsure, to add the ppa to your sources do sudo add-apt-repository ppa:txwikinger/php5.2 from the command line. Be sure to follow the ppa link in the post and apply txwikinger's pinning solution. Make sure you run sudo apt-get update before you try and install the packages!
    – adamnfish
    Feb 8, 2011 at 16:31
2

It is possible to use karmic packages and pin them with aptitude. This can be done by using this commands:

# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# use karmiс for php pakage
# pin-params:  a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n"  | sudo tee   /etc/apt/preferences.d/php > /dev/null
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release   a=karmic\nPin-Priority: 991\n"}'|sudo tee -a /etc/apt/preferences.d/php > /dev/null
apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| sudo tee -a /etc/apt/preferences.d/php > /dev/null
echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n"  | sudo tee -a     /etc/apt/preferences.d/php > /dev/null
# add karmic to source list
grep 'main restricted' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee             /etc/apt/sources.list.d/karmic.list > /dev/null
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo aptitude install -t karmic php5-cli php5-cgi
# or (and) sudo apt-get install -t karmic  libapache2-mod-php5
sudo aptitude hold `dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "`
#done

Got this from link text

2

There's a great blog post about this at http://civicactions.com/blog/2010/may/26/ubuntu_1004_and_drupal?page=1#comment-3717

2

I've recently tried to solve the same problem myself. Instead of making changes to the package management I compiled PHP 5.2.17 from the source code myself and then used the program Checkinstall to install the new .deb package on my system.

I wrote up the steps in a blog post, Compiling PHP 5.2 for Ubuntu 10.10, but the steps basically involved the following:

  1. Download PHP source (http://php.net/downloads.php) to /usr/local/src
  2. Configure source, reading INSTALL doc and output from ./configure --help

my configure command looked like this:

./configure --prefix=/opt --with-apxs2=/usr/bin/apxs2 --with-curl=/usr/lib --with-pgsql --with-pear --with-mysql --with-gd
  1. Compile the source using 'make'
  2. Install the compiled package using 'checkinstall'

And that was it. I had already installed Apache2 using Synaptic (you need to use the apache2-mpm-prefork package for use with PHP). Also if you had any PHP5 pacakges already installed you would need to uninstall them before trying to install your own compiled package.

Compiling the package yourself really doesn't take long at all and is a good experience if you haven't done it already on your Ubuntu machine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .