FreeBSD 8.1, Zend Optimizer, php52-extensions and the dreaded Segmentation Fault (Core Dumped)

Jan 29th, 2011 | By | Category: Technology

So I haven’t slept in 43 hours, it’s been at least 10 years since I’ve pulled this kind of stunt before but as you know from my last blog post here my server blew up and then my lappy blew up, so lots and lots to keep me busy with.. Part of that fun was doing a brand new fresh OS install on my server, and getting everything working just as it was before is never a cakewalk.  Well it was looking like it was until I started seeing this little Segmentation Fault at the end of my php -v statement.  I mean not to mention the 5-6 hours I spent wresting with ZendOptimizer but that was resolved and wasn’t nearly as epic, nor as disappointing at the 20+ hours that went into figuring this god awful problem.

For whatever reason when php52-mysql or php52-pdo_mysql were installed there would always be a segmentation error in shell.  It didn’t affect the websites mind you, that ran fine but running anything with php through shell wasn’t not happening(there goes 1/2 my cron).  So what do I do? I hop on freenode, undernet and efnet and start asking around as well as googling my face off.  And man oh man there are a ton of reasons why this could be happening and trust you me I went through them all.. But the key problem with my problem solving was that I was looking in completely the wrong place.  You see early on I was convinced that this was a php problem.  Probably set that way as an impatient chap named GoMYSQL on #mysql on freenode quite quickly told me it was and to take my question out of his sacred and holy channel.  So for the next 30 hours or so I proceeded to rip the very fabric of php apart in search of what cuold be causing this.  I commented out everything in extensions.ini, in php.ini narrowing it all down to mysql.so or alternatively pdo_mysql.so caused the same problem.   There was talk about the order of the extensions in extensions.ini causing issue so I tried mysql.so in every single spot on that list to no avail, the only thing that made the seg fault go away was to comment out mysql.so itself but then that kind of left me without a slightly important piece of functionality.

Well guess the fuck what?  It isn’t a php issue at all, it is a problem with mysql55.  For whatever reason I installed mysql55 instead of mysql50(bigger is better right?) and whether it’s a conflict with mysql55 and Zend, or Zend, php52-mysql and mysql55, or all of the above and eaccelerator or what but having that version of mysql installed caused this whole mess in the first place.

So her I am, 43 hours later and probably at least a dozen pots of green tea, completely out of option I figure why the hell not try mysql50?  On this old server it’s a hell of a wait to deinstall and recompile but nothing else is working.  Lo and fucking behold the minute it’s up and php52-extentions and php52-mysql are recompiled along side all my worries dissapear.  No more zend seg faults, no more mysql.so seg faults nada, zip zilch.

And for whatever reason this will be the very first post/article anywhere offering this advice because everyone else is dealing with a php issue.  So if this is you, if you have just installed php52 and php52-mysql or php anything-mysql and you are seeing everything loading fine except for mysql.so causing a segmentation fault do yourself a big favor and check what version of mysql you have installed.   If you are running mysql55 and Zend, or eAccelerator and Zend and mysql or any combination of the bunch get rid of mysql55 and install mysql50.  After you’ve done that you’re going to need to recompile php52-mysql and/or php52-pdo_mysql(or whatever version of phpxx-mysql you’re running) and then go in and recompile php52-extensions.  After all that restart apache and go to sleep!

I know that’s exactly what I’m about to do

Tags: , , , , , , , , , , , , , ,

Leave a Comment