Friday, January 05, 2007

FreeBSD + PHP 5.2 + Apache seg faults

I recently upgraded my FreeBSD php5 port to PHP 5.2.0. After upgrading the Apache module and all the extensions, something was segfaulting whenever I would try to load Horde. I tried everything I could think of and dug around in the FreeBSD mailing lists for solutions. The problem seemed to lie with the ordering of the PHP exentions in /usr/local/etc/php/extensions.ini. According to this page at pingle.org and some messages on freebsd-ports, the key is to load mysql.so, then imap.so, then sockets.so. Tried that and every other suggestion I could find but nothing helped.

Finally, I tried making my compiler optimizations less aggressive. In /etc/make.conf, I normally have this:
CFLAGS=-O2 -pipe -funroll-loops -march=pentium4
but I just reduced it to "CFLAGS=-O" and recompiled php5 along with all my php5-* ports, then restarted Apache. Finally Horde loaded!

(Platform notes: FreeBSD 5.x, but reports indicate this is also a problem at least on 6.x; Apache 2.2.x; PHP 5.1.6 was working fine with the aggressive compiler optimizations; host has Pentium4 XEONs.)

Labels: , ,