Skip to main content

CentOS4 and CiviCRM 2.1

With the new year, a new resolution to upgrade some sites to the new CiviCRM 2.1. CiviCRM 2.1 is particularly special because it requires Drupal 6 and it's the first version that supports Drupal 6. So upgrades of existing Drupal 5 sites are difficult, particularly if any custom modules or themes involved.
As it turned out, my procrastination was justified. I asked my friend Rob Ellis to help with Maquila Solidarity Network, who I've been working with for a few months, and who decided that the new features in 2.1 were too good to postpone any longer. Rob did the upgrade and discovered two issues on my CentOS 4 server:
  • The CiviCRM installer insists on PHP 5.2.x
  • CiviCRM requires a version of PCRE with unicode
None of this sounds very interesting, and I wouldn't post about it, except that I would have thought it wouldn't be as hard to fix as it was. So here's what I did, in case there's someone else out there with CentOS4 (or RHEL4) trying to run CiviCRM 2.1.
Running CiviCRM 2.1 on a normal CentOS4
The original RHEL4 (and hence CentOS4) comes with php4, which is really not okay any more, but the CentOS 'extras' repository has php 5.1, which is what I've been using for the past 2 years on this server. Unfortunately, there don't seem to be any plans to upgrade this to 5.2.
From my brief reading, it looked like there wasn't a big difference from 5.1 to 5.2, and the CiviCRM maintainers didn't promise that it wouldn't work on 5.1. So the first thing Rob did was just fiddle with a couple of installation files to allow the installation to procede with 5.1. Not too surprisingly, it worked, almost.
What actually created errors, was a problem with PCRE, which is the Perl Regular Expression library. So, rob found the file that was generating the errors (packages/IDS/Converter.php) and patched it in a few places (hey, it's an external library) where it thought it cared about unicode, and voila, it worked.
Conclusion: CiviCRM 2.1 can run with slight modifications on CentOS4 (and RHEL4). Yay rob!
On The Other Hand
But I really didn't relish maintaining these modifications to CiviCRM through multiple installs and upgrades, and updating my php to 5.2 and my pcre to unicode both seemed like sensible things to do. Whether it was sensible remains to be seen, but here's how I did it.
PHP 5.2.x on CentOS4
When I googled this, I ended up being pointed to a repository called "utter ramblings", which I tried to use. While I appreciate the work Jason did on this, it didn't work. The problem arose that his upgrade also required a version of a library on which subversion depended, and he chose the standard CentOS/RHEL4 version of subversion, so his upgrade was incompatible with my up to date subversion package from Dag. I also just wasn't quite convinced that he really wanted to be keeping his repository going for a long time. As an aside, the php upgrade also thought it needed to upgrade my apache to 2.2, which wasn't a bad thing, but made the whole upgrade a little more risky and complicated.
There was another repository by a french-speaking guy called 'remi' that many people praised, but I found myself shying away from it also, based on a fear of language confusion and the fact that he was hosting his repository on a domain called 'family collette'. This was probably unfounded paranoia on my part, and his repository might have been completely adequate.
What I did end up finding, though much less prominent, is the 'atomic rocket turtle' repository, which you might think i'd avoid even more because of it's name. But it was very impressive technically - he must have a pretty good understanding of what he's doing and a good automatic build environment because he had the latest version of php 5.2 compiled shortly after it had come out in December.
So - i just followed the instructions, ran the update and it did a nice clean minimal update of php 5.2 and just a couple of small dependencies that didn't break anything else.
Of course, I had to upgrade my version of APC, but that was to be expected since I don't maintain it from YUM.
PCRE with Unicode on CENTOS4
I had hoped my php 5.2 upgrade would solve the pcre problem, but it didn't. That was because the php installed (as well as the previous one - presumably a CentOS/RHEL standard) uses the option that tells php to use the installed OS library. So I had to go learn about my CentOS version of PCRE (which was dated 2003) and why it didn't support unicode.
That turned out to be confusing on google, because it seems I'm not the only one to be messed up about the difference between UTF-8 and unicode. The version I had did have UTF-8. but not unicode support.
The solution turned out to be a combination of these two posts:
Look for "Add Unicode Properties Support to PCRE".
The only problem with it was it was for the wrong version of CentOS, so I found:
which pointed me at a broken link for a fedora 6 src rpm, which i eventually found here:
Using that, with jason huck's instructions, turned out to work just fine.
Conclusion: you can update your CentOS4 to run CiviCRM 2.1 without modification, though some assembly is required. Specifically: recompiling source RPMs.


Friends General said…
Hey - found this post helpful. Got as far as upgrading my testing server to PHP 5.2 - only to find this post.
Looks like they 5.2 requirement is arbitrary - at least for CiviCRM 2.1. I've found people who disabled the version check, and haven't had any problems.
Alan Dixon said…
True, but you're probably better off with 5.2 - there are enough mysteries with CiviCRM to not have another potential source of confusion. The other big reason that it's good to upgrade to 5.2 is the Drupal date module.
Anonymous said…
You made my morning. This totally helped me out.


Popular posts from this blog

Me and varnish win against a DDOS attack.

This past month one of my servers experienced her first DDOS - a distributed denial of service attack. A denial of service attack (or DOS) just means an attempt to shut down an internet-based service by overwhelming it with requests. A simple DOS attack is usually relatively easy to deal with using the standard linux firewall called iptables.  The way iptables works is by filtering the traffic based on the incoming request source (i.e., the IP of the attacking machine). The attacking machine's IP can be added into your custom ip tables 'blacklist' to block all traffic from it, and it's quite scalable so the only thing that can be overwhelmed is your actual internet connection, which is hard to do.

The reason a distributed DOS is harder is because the attack is distributed from multiple machines. I first noticed an increase in my traffic about a day after it had started - it wasn't slowing down my machine, but it did show up as a spike in traffic. I quickly saw that…

CiviCRM's invoice_id field and why you should love the hash

I've been banging my head against a distracted cabal of developers who seem to think that a particular CiviCRM core design, which I'm invested in via my contributed code, is bad, and that it's okay to break it.

This post is my attempt to explain why it was a good idea in the first place.

The design in question is the use of a hash function to populate a field called 'invoice_id' in CiviCRM's contribution table. The complaint was that this string is illegible to humans, and not necessary. So a few years ago some code was added to core, that ignores the current value of invoice_id and will overwrite it, when a human-readable invoice is generated.

The complaint about human-readability of course is valid, and the label on the field is misleading, but the solution is terrible for several reasons I've already written about.

In this post, I'd like to explain why the use of the hash value in the invoice_id field is actually a brilliant idea and should be embrac…

Upgrading to Drupal 8 with Varnish, Time to Upgrade your Mental Model as well

I've been using Varnish with my Drupal sites for quite a long while (as a replacement to the Drupal anonymous page cache). I've just started using Drupal 8 and naturally want to use Varnish for those sites as well. If you've been using Varnish with Drupal in the past, you've already wrapped your head around the complexities of front-end anonymous page caching, presumably, and you know that the varnish module was responsible for translating/passing the Drupal page cache-clear requests to Varnish - explicitly from the performance page, but also as a side effect of editing nodes, etc.

But if you've been paying attention to Drupal 8, you'll know that it's much smarter about cache clearing. Rather than relying on explicit calls to clear specific or all cached pages, it uses 'cache tags' which require another layer of abstraction in your brain to understand.

Specifically, the previous mechanism in Drupal 7 and earlier was by design 'conservative' …