Fixing CakePHP 1.3’s Cache key error on Red Hat and CentOS

I ran across this today, when upgrading from CakePHP 1.2 to 1.3 on a CentOS box. Since the bug didn’t appear on Windows, after a bit of debugging I realized it was actually caused by a misconfiguration in the PCRE library that ships with RedHat and thus CentOS 5.x. It’s been reported to CakePHP but it’s not their fault, it just surfaces in View::element() because that uses Inflector::slug(), which in turn relies on PCRE. I guess this codepath has changed since 1.2, hence it showed up during the migration.

Fixing it was not difficult though, based on this blog post and these directions. Then rebuild PHP, bounce Apache, and you’re fixed.

Update 2/8/11: If you’re on 64-bit, change the RPM upgrade line to be

rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre-6.6-2.7.x86_64.rpm /usr/src/redhat/RPMS/x86_64/pcre-devel-6.6-2.7.x86_64.rpm

Update 1/30/2012: See updated instructions for CakePHP 2.0.

2 comments

Leave a comment

Your email address will not be published. Required fields are marked *