Make Pressflow/Drupal compatible with Ubuntu Lucid Lynx aka 10.04
If you have upgraded to Ubuntu Lucid while doing some drupal developments, you have probably realized that it’s shipped with PHP 5.3 which is incompatible with many contibuted modules (yep your projects would display crazy warnings all over the place). There are many solutions to this (until all modules are compatible with php 5.3) :
- Find the latest patches to fix the problems for each contributed module — well if you find them
- Get your hands dirty and fix the contributed modules that break — this is kinda cool and don’t forget to contribute back the patches to drupal.org.
- Change the error level reporting by hacking “includes/common.inc” file in drupal so that it will not display warnings (suppressing warnings in php.ini doesn’t work since drupal bypass those settings) — this is not really good if you actually write modules because you won’t get any error notifications which is bad.
- Downgrade to php 5.2.6 without leaving your lovely Ubuntu Lucid — well some people just want to run drupal projects without warnings, without getting their hands too dirty and now!!!
For the last option, well you came to the right place
. Basically what we are going to do is tell Ubuntu Lucid , “whenever you want to install any related php thing, don’t install the lucid version, install the karmic version which is capped at 5.2″.
So go ahead and open your awesome terminal and run:
my_php_related_pkgs_installed=`dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Now download this script and put it somewhere and run it with :
chmod +x php.sh
./php.sh
if you can’t download the file, below is the content, copy and save it in a file :
# remove all php packages
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# use karmiс for php pakages
# pin-params: a (archive), c (components), v (version), o (origin) and l (label).
echo "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 "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null
# add karmic to sources list
egrep '(main restricted|universe|multiverse)' /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 5
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
Now reinstall back your previously installed PHP packages:
sudo apt-get install $my_php_related_pkgs_installed
There you go, you have your Pressflow/Drupal compatibility on Ubuntu Lucid!


Thanks for the solution, it seems right on target. I believe I got it to work once. However just tried, and my php files aren’t parsing. Rather it’s forcing a download. What do you think could be wrong.
@joe
i think you messed up with some of the sources.list
try to install this :
sudo apt-get install apache2 apache2-utils mysql-server php5 libapache2-mod-php5 php5-mysql mysql-client libapache2-mod-auth-mysql php5-dev php5-gd php-pear php5-curl php5-memcache php5-xmlrpc php5-xsl php5-imagick php5-mcrypt php5-xdebug
remove the extensions you don’t need if you want. if no dependencies problems, you should be setup
Thanks so much Salimane, I actually just got it parsing. Then I fed the extensions from your post into the terminal, I want pecl and apc etc. so I’m keen on getting those you listed to work. However, I’m getting pushed back on a couple and a broken package error, there’s some conflicts etc.:
The following packages have unmet dependencies:
php-pear: Depends: php5-common (>= 5.3.2-1ubuntu4.2) but 5.2.10.dfsg.1-2ubuntu6 is to be installed
php5: Depends: libapache2-mod-php5 (>= 5.3.2-1ubuntu4.2) but 5.2.10.dfsg.1-2ubuntu6 is to be installed or
libapache2-mod-php5filter (>= 5.3.2-1ubuntu4.2) but it is not going to be installed or
php5-cgi (>= 5.3.2-1ubuntu4.2) but 5.2.10.dfsg.1-2ubuntu6 is to be installed
Depends: php5-common (>= 5.3.2-1ubuntu4.2) but 5.2.10.dfsg.1-2ubuntu6 is to be installed
E: Broken packages
What should I do?
Thanks again,
Joseph
@joseph
i think it’s better to go back and install all php 5.3 and then run again the downgrade :
sudo rm -rf /etc/apt/preferences.d/php
sudo apt-get update
sudo apt-get install apache2 apache2-utils mysql-server php5 libapache2-mod-php5 php5-mysql mysql-client libapache2-mod-auth-mysql php5-dev php5-gd php-pear php5-curl php5-memcache php5-xmlrpc php5-xsl php5-imagick php5-mcrypt php5-xdebug
sudo /etc/init.d/apache2 restart
then follow this downgrade again
and at the end of the script run again :
sudo apt-get install apache2 apache2-utils mysql-server php5 libapache2-mod-php5 php5-mysql mysql-client libapache2-mod-auth-mysql php5-dev php5-gd php-pear php5-curl php5-memcache php5-xmlrpc php5-xsl php5-imagick php5-mcrypt php5-xdebug
Thanks
Thanks so much for your help Salimane, the message persisted. Probably something I did earlier. I wimped out and decided to use Karmic instead
@Joe
sorry to hear that, but you should give it a try again, because lucid is just awesome
Thanks
Thanks Salimane…someday I’ll have to roll up my sleeves
I did too find lucid awesome…I just have so many drupal 6 modules, I’m kind of married to php 5.2 at the moment, and karmic seems to fit that bill with ease. Thanks so much!