Archive for January, 2011

Published by Rolf on 27 Jan 2011

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.

Published by Rolf on 02 Jan 2011

FirePHP and CakePHP-Facebook-Plugin class collision

This took me an awfully long time to debug, but if you happen to be using both the CakePHP Facebook Plugin and FirePHP version 0.3.2 Server Library, you will get “redeclaration” errors if you try to include both FirePHP and the Facebook Connect component. This is because they both declare a FB() class.

Eventually the solution was simple, just rename all instances of the FB class in the FirePHP code, to “FireBug”. I did this for the PHP5 version only, since I didn’t care about PHP4. Zipped and attached if you’d like to use it.

FirePHPCore-patched.zip