As of version 6.14, Drupal works with PHP 5.3, but many essential modules still issue warnings (usually due to passing expressions by reference). If your Ubuntu 10.04 (Lucid Lynx) server is running 5.3, this script will automate the downgrade to the latest 5.2 by telling aptitude to use the source lists for Ubuntu 9.10 (Karmic Koala).
Thanks to Nick Veenhof, mrkandy, and their many commenters, from whom this script is derived.
php_installed=`dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` # remove all php packge sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` # use karmic 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 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 sudo apt-get install $php_installed sudo aptitude hold `dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "` #done
Of course, make sure to restart Apache when you’re finished.
Thank you very much for the writeup.
Saved me hours!
thx, this was very helpfull!
Great job reducing all those comments to one script.
2 things:
1. The last line stops php from being updated?
2. “lucid” should be now changed to “maverick”, or better, “maverick” added alongside “lucid” to the regex