Drupal development on Lucid Lynx

nenne's picture

There is a problem with Lucid Lynx and Drupal, Lucid Lynx comes with php5.3 and Drupal code doesnt run smoothly on that version. So what we want to do is to revert back to 5.2 on, how do we do that? Its simple:

  • Remove all php packages(using remove or purge): sudo apt-get purge php5*
  • Clean out all downloaded package files: sudo apt-get clean
  • Add a sources.list for karmic packages by running: sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
  • Create a file in /etc/apt/preferences.d called php5 or something like that
  • Add the following to the file:
  • Package: php5
    Pin: release a=karmic
    Pin-Priority: 991

    I had to create one of these files for php5-common and php5-mysql to so you might have to do that.

  • Update your'e repositorys: sudo apt-get update
  • Install the packages again.
  • Comments

    Php 5.3

    getting-wiser's picture

    I thought I read on Drupal.org that php 5.3 is supported by Drupal 6.14 and higher.

    I also read elsewhere online the following: "It is best to use php 5.3 on Ubuntu if the modules imagecache and imagecache actions are to be used. Both rely on the GD lib. Php's built-in GD lib was declared a security risk by Ubuntu so it is not included. Php 5.3 fixes the problem" That confused me but it is a verbatim quote.

    As I am setting up a linux box at linode, I am currently trying to decide which flavor of linux to use and what installation quirks I'll need to deal with. I am a system admin noob who has never worked in linux but I am teachable and am learning. Your words have importance to me but I admit that I am now confused by the mixed instructions I am reading.

    There is an issue on the php

    nenne's picture

    There is an issue on the php 5.3 problem over here: http://drupal.org/node/360605

    Here is a quick explanation of every step:

  • Remove all php packages(using remove or purge): sudo apt-get purge php5*
  • apt-get is a command for using "aptitude" which is the application for package management in Debian(Ubuntu is based on Debian) based OS's. You use it for uninstalling, installing, upgrading(and more) applications. It fetches the packages from something that is called a "repository", basicly a server that hosts these packages. The command above simply removes the installed php5 applications.

  • Clean out all downloaded package files: sudo apt-get clean
  • This command cleans aptitudes cache of downloaded packages. Forcing it to redownload on reinstallation.

  • Add a sources list for karmic packages by running: sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
  • The /etc/apt/sources.list contains all the repositories where aptitude looks for software. What we do here is to add the repository for ubuntu 9.10(karmic koala) so we can instruct aptitude to install php5 from there instead. This repository contains pre 5.3 versions of php so this would fix our problem. The file with this karmic.list file is placed in sources.list.d/ which is a directory for other repository list files.

    This line simple streams the data from /etc/apt/sources.list, replacing every occurance of "lucid" with "karmic" and uses the | command to forward that datastream to the tee command. More information on these commands and the | can be found here:

    http://unixhelp.ed.ac.uk/CGI/man-cgi?sed

    http://unixhelp.ed.ac.uk/CGI/man-cgi?tee

    http://www.linux.com/archive/feed/45679 <- About Pipes like | (and filters)

  • Create a file in /etc/apt/preferences.d called php5 or something like that
  • This is a directory where you place files with settings for particular packages. In this case forcing the use of a the karmic repository we added:

  • Add the following to the file:
  • Package: php5
    Pin: release a=karmic
    Pin-Priority: 991

  • Update your'e repositorys: sudo apt-get update
  • This command updates the information concerning from the repositories.

  • Install the packages again.
  • using apt-get install php5 php5common etc we then install all the packages again.

    I hope that helped, tried to be thurough. :)

    I will never cease to be

    getting-wiser's picture

    I will never cease to be amazed by the Drupal community. I have read the rants about some who volunteer support but I, for one, have never had that experience. Instead, I find people like the OP, Nenne, who take time out of their busy days to give very detailed help to a noob. Thank you so very much Nenne!

    I am working on installs of apache, php, mysql on the linode server this weekend. Not sure if I will go with a bundled lamp or install from source code. Your instructions are perfect timing and I am so grateful for the explanations. After I go through each step, I'll come back here to report if I have questions or breezed through.

    So, yep, you have been a huge help and I am grateful you being thorough!

    :-)

    If you are replacing all of

    acouch's picture

    If you are replacing all of the packages with those from karmic, is there a benefit to upgrading a server from 9.10 to 10.04?

    Thanks for your post.

    re: If you are replacing all of

    Greg Coit's picture

    Yes, there are a few benefits to upgrading. Besides getting upgraded version of almost every package (except PHP of course), 10.4 is a long-term support release ( LTS) which means 5 years of support (for servers - desktop is 3 years). A non-LTS server only gets 18 months.

    We've posted some instructions and files here that might help:

    http://groups.drupal.org/node/72718

    Thanks!

    Greg

    --
    Greg Coit
    Systems Administrator
    http://www.chapterthree.com

    Better Solution is to patch ImageAPI

    wesnick's picture

    Tried this solution and it had all kinds of messy, unintended consequences. Then I found this nice patch for ImageAPI which solved this problem more elegantly.

    http://drupal.org/node/540486#comment-2616056

    There are still a whole bunch of other modules that throw warnings, but not planning on using php 5.3 on a production server anytime soon

    I needed reinstall libapache2-mod-php5 as well

    pkiraly's picture

    Hi nenne,

    this is a great description, but in my machine needed another step: reinstalling libapache2-mod-php5 as well, because the command line PHP became 5.2, but the one runs inside Apache remained 5.3. The steps I taken:

    I created a file /etc/apt/preferences.d/libapache2-mod-php5 with the following content:

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

    Then issued the command: sudo apt-get install libapache2-mod-php5.

    Finally restarted Apache: sudo /etc/init.d/apache restart or sudo apache2ctl -k restart

    I'd say it would be far

    mrfelton's picture

    I'd say it would be far better to use this opportunity to track down individual instances of PHP 5.3 incomparability, report any problems to the relevant module maintainers, and submit patches if you can. We don't want to have to tell people to run out dated, insecure software so that they can run Drupal properly, what kind of image does that send out?!

    --
    Tom
    www.systemseed.com - drupal development. drupal training. drupal support.

    Totally agree with you

    Manuel Garcia's picture

    I refuse to follow this or similar tutorials out there to downgrade PHP on lucid.

    The smart thing to do is to file bug reports & patches to contrib modules you find that don't work with this version of PHP.

    isaac.el.cec@gmail.com's picture

    +1 ;-)

    Saludos
    Isaac.el.Cec
    - Temas DRUPAL: http://drupal6.propium.org
    - Güep profesional: http://www.jramonet.org

    Agreed

    TomSherlock's picture

    And I agree with all three above. Mac OS X 10.6.4 (Snow Leopard) comes with PHP 5.3.1. I'm now trying to figure how to get php working again. While apache seems to be fine after my jumping through some hoops.

    Good point Tom. Love yr site

    acouch's picture

    Good point Tom. Love yr site btw.

    Full Pin List

    glass.dimly's picture

    Hey all,

    I ended up needing to pin a bunch of packages before I could make this work. I also included the pin php5-mcrypt which is a dependancy for phpmyadmin.

    PS, for noobs, this can all go into one pin file, which can be named anything, under /etc/apt/preferences.d/

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

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

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

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

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

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

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

    then ran

    sudo apt-get install libapache2-mod-php5
    sudo apt-get install apache2 php5 php5-mysql php5-gd mysql-server php5-cli

    Now you just have to worry about your Apache configurations, and your /etc/hosts file for your localhosts.

    My quick recipe for Lucid with PHP 5.2