Drupal 6.x And CentOS 5.x

This is more a bookmark for my reference than anything, but if you have a stock CentOS 5.x installation (maybe from a VPS image or a clean install on a dedicated box) you're going to have issues with Drupal 6.x.

It comes down to PHP version. It ships with PHP 5.1.6 and Drupal these days pretty much depends on PHP 5.2.x upwards to work. Utilities like Drush do too, so leaving PHP as it is, you'll find, is not really an option. To confirm you will have this problem, execute this command to check your PHP version:

$ php -v

I came across this post about installing PHP 5.2.x on CentOS:
http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum

The author seems to be a Drupal developer too, as they list a number of modules that will not function with stock CentOS. They also link out to two pages (the only ones you need really). Though I'm re-writing their tutorial slightly, as there are things which will make it easier.

Before you start though, I recommend you update CentOS to the latest packages by running this command:

$ yum update

That will probably take a while, as the chances are your image is a year or so old and updates have never run. It should go smoothly though, as one of the advantages of CentOS (effectively RHEL) is it's tested to destruction before updates are released. =)

Once you've done that, you should install the yum priorities plug-in by following the instructions here:
http://wiki.centos.org/PackageManagement/Yum/Priorities

This software will enforce priorities in the order you state, e.g. if there are two PHP packages in separate repositories that are the same, yum priorities will make sure the highest priority repository takes precedence. (This will make sense once you've read the link above.) I set up the CentOS repositories as advised on the wiki page.

Then you can go here and install Jason Litka's alternative RHEL packages:
http://www.jasonlitka.com/yum-repository/

The instructions here should, in theory, smoothly update CentOS to use Jason's packages (where provided) instead of the main packages. Follow his instructions down to the editing of utterramblings.repo and then use these settings instead:

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
priority=1

Almost the same, but we've added a priority line (equal to the main CentOS base repositories) so the repository is not ignored by yum.

Then *do not* just run yum update as he states. I got a boatload of dependency issues relating to MySQL and Subversion when I did that. All I want to do is update PHP, so instead run this:

$ yum update php*

That will update all the packages whose name begins with "php", all of which make for the PHP update you require, and all were without dependency problems from a stock image (at time of writing). After the update, check PHP version again:

$ php -v

It should say:

PHP 5.2.6 (cli) (built: May  5 2008 14:41:03)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

Sorted! =)

One word of warning... You *might* see something like this:

$ php -v
PHP Warning:  PHP Startup: fileinfo: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning:  PHP Startup: readline: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP 5.2.6 (cli) (built: May  5 2008 14:41:03)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

If you do, it's caused by PECL PHP modules that were not updated because they are not in Jason's repository. You need to remove them. You can find out what to remove by running a command like this (taking the "fileinfo" above as an example):

$ yum search fileinfo
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* extras: mirror.sov.uk.goscomb.net
* updates: mirror.sov.uk.goscomb.net
* base: mirror.sov.uk.goscomb.net
* addons: mirror.sov.uk.goscomb.net
===================================================================== Matched: fileinfo ======================================================================
php-pecl-Fileinfo.x86_64 : Fileinfo is a PHP extension that wraps the libmagic library

Now you have the offending module's package name:

$ yum remove php-pecl-Fileinfo.x86_64

If you *need* any of these removed packages, you'll have to find newer RPMs compiled for Jason's recommended PHP version (currently 5.2.6) and re-install yourself. The great thing is these are always only single packages without dependencies, so there should be no need for "dependency hell" to be unleashed.

Interesting

Interesting about the version of PHP. I have installed Drupal 6.10 on CentOS 4 with PHP 4.3.9.

MySQL 5.2

http://drasgard.blogspot.com/2009/04/drupal-hosting-on-centos.html

says:

"This will update mysql to version 5.1, which seems to be required for the php 5.2 packages."

Is that true?

No

MySQL 5.1 is *not* required for PHP 5.2 (I didn't install it and everything's fine). In fact, the update attempts to install MySQL 5.1 on the VPS.NET image I wrote these instructions for but fails due to unresolvable dependencies, so actually I couldn't install MySQL 5.1 from Jason's repo without doing some extra work. (I didn't care, so I didn't bother...)

PECL

As an alternative to some RPMs, if you have the php-pear (I think) RPM installed you can also manually install uploadprogress and fileinfo (useful in Drupal installs).

pecl install uploadprogress

then if all goes well add

extension=uploadprogress.so

to php.ini

More

While we're talking about extra repos for CentOS, there's a page on it in the CentOS wiki:
http://wiki.centos.org/AdditionalResources/Repositories

There's also the Remi Repos

There's also the Remi Repos available for Centos.
see: http://blog.famillecollet.com/pages/Config-en

You can use his RHEL packages there. I think he just released
rpm's for php 5.3.

enabled line

For extra repos where you want to manually update only, it's a good idea to go back to utterramblings.repo and set enabled = 0 after you're done updating. That's what I do for some extra rpms I need from rpmforge on my CentOS VPS. It prevents conflicts (and other surprises) if you ever do a yum update all or if you run some other scheduled automatic update.

the RedHat / CentOS version of php 5.1 is an upgraded version...

The odd thing here is that the version of PHP 5.1.6 that RedHat/CentOS supplies isn't the same as the released version - it's had new features backported.

It seems likely that Drush would actually work with this version - but it checks the version number and bails.

See

http://drupal.org/node/502452

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.