Ubuntu 10.04 and Drupal

Fen Labalme Profile Photo from DCSF
Fen Labalme

on

May 26, 2010

Ubuntu 10.04 and Drupal

If you install Ubuntu 10.04 and you're running Drupal sites, you may want to downgrade the installed PHP 5.3 to 5.2, as though recent Drupal core is mostly 5.3 compatible, some contributed modules aren't yet.

Owen Barton pointed me to this handy set of PHP downgrade instructions that had worked for him.  These instructions purge the current PHP5 apps, "pin" the apps to the karmic (9.10) repository, add the karmic repositories to your source list, and then reinstall the primary apps (php5-cli, php5-cgi and libapache2-mod-php5).

This all worked for me, too, but I have a couple additional suggestions:

First, before you start, run:

php_installed=`dpkg -l | grep  php| awk  '{print $2}' |tr "\n" " "`

This saves a list of the additional PHP apps and libraries that you'll want to re-install when you're done.  You can view them easily, of course, with:

echo $php_installed

Then run KAndy's script.  Once complete, to get the rest of your installed PHP packages, run:

sudo apt-get install $php_installed

This worked for a lot of my packages, but one of my packages was phpmyadmin which required php5-mcrypt, both of which are in the "universe" repository rather than the "main restricted" one.  So I added these four lines to my /etc/apt/sources.list.d/karmic.list file:

deb http://archive.ubuntu.com/ubuntu/ karmic universe
deb http://archive.ubuntu.com/ubuntu/ karmic-updates universe
deb http://archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse

After running "apt-get update" again, I was able to add all of the rest of my packages.  Instead of adding these manually, you could also replace line #10 in KAndy's script with:

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

I'm really enjoying Ubuntu 10.04.  And so is my wife as it has fixed several stability issues on her Dell laptop.  I think you will, too!

Share it!

Thanks for this very useful write up!

Thanks for sharing this insightful post on Ubuntu 10.04. This takes some working to achieve.

The specific modules that have issues with php 5.3 include date and calendar.

The core modules and many others seem OK re php 5.3.

 

Thanks, this is a good post to be writing right now. I am currently using a development machine and Drupal gives a number of warnings. It is possible, as an earlier commenter mentioned, to ignore these deprecation warnings, but is this really the way to go? I'd prefer to know that there were no warnings rather than sweeping them under the carpet.

The community that supports and improves Drupal is made up of people like you and me that see an issue, fix it and contribute the fix (as a patch) back to drupal.org.  Submitting patches to D6 and it's modules is the #1 preferred way to resolve this issue as everyone benefits.

If you just want to lose the warnings, you can use the trick previously posted - more in this thread: http://drupal.org/node/360605 - though there may be some modules that have greater incompatibilities (see e.g., http://forum.civicrm.org/index.php?topic=10729.0).

If you want to punt altogether and downgrade, that's what the original post was about.

Finally, Drupal 7 (and CiviCRM 3.2) will be compatible with PHP 5.3, so if you can wait for that (and don't need to support legacy sites) stick with PHP 5.3.  If you want to help with getting Drupal 7 out the door, see the issue queue.

So I've followed the instructions however I'm getting an error when I run apt-get for the $php_installed

Invalid record in the preferences file /etc/apt/preferences.d/php, No package header.

Any ideas?

Not sure, but take a look at the file.  It should have a bunch of three-line entries that look like this:

Package: php5
Pin: release a=karmic
Pin-Priority: 991

...basically one for every package in your $php_installed variable.

You can re-create it by wiping it and re-running lines 5-8 of KAndy's script.  Be sure to run "apt-get update" again.

Good luck!

I just killed the file and rebuilt it by hand with the packages I needed. Thanks for the tip and the info. My PHP is back to 5.2!

 

 

I just started setting up a Drupal development machine last night using Ubuntu 10.4, but hadn't yet loaded Drupal. I had completely forgotten about the compatibility issue with PHP 5.3, so your timing could not be more perfect. Thanks!

Rather than systematically downgrade, I try to develop on php 5.3, and file patches to the modules that break. Given that 10.04 is a LTS release, hosting platforms will likely start running php 5.3, so it seems vital that Drupal also run on php 5.3.

@jhedstrom has it right and I hope that my post doesn't in any way decrease the amount of good work being done by many - though never enough - to help Drupal and it's contributed modules move forward.

Additional information and lots of useful comments on how to approach different solutions for this downgrade can also be found on http://nickveenhof.be/blog/reverting-or-downgrading-php-53-52-ubuntu-luc...

A step by step tutorial is also included

I had some issues with CiviCRM (see thread at http://forum.civicrm.org/index.php?topic=10729.0) and I've heard there are other issues, too - though have not personally experienced them.  CiviCRM 3.2 will address the compatibility issues, but that's not yet in Beta.

Which modules are breaking?  I've found a few modules (date, for example) to throw deprecation warnings, but that's all.  These were easily fixed by adding the following lines to my settings.php files (for some reason, it's not picking up in php.ini):
ini_set('error_reporting', 'E_ALL & ~E_DEPRECATED');
Are there any other incompatibilities you've found besides deprecation warnings?

Post a comment

The content of this field is kept private and will not be shown publicly.