Getting eAccelerator 0.9.5 to run correctly

Over the weekend, I upgraded the server that hosts CMS Report with the latest stable releases of MySQL and eAccelerator. The upgrade from MySQL 4.1 to 5.0 was easy compared to the upgrade I made a year ago from MySQL 3.23 to 4.1. This time around I also have use of CPanel which meant I could make the database upgrade with at least one eye closed. My journey with upgrading from eAccelerator 0.9.4 to 0.9.5 however took a lot longer.

I've been using eAccelerator 0.9.4 since it was released early in 2006. I've gotten into some trouble in the past by those smarter than me when I tried to explain exactly what eAccelerator does and does not do. To play it safe this time around, I'll give you the summary of what eAccelerator does straight from eAccelerator.net:

eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

...eAccelerator stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks only for a short time, while searching for a compiled PHP script in the cache, so one script can be executed simultaneously by several engines. Files that can't fit in shared memory are cached on disk only.

Since eAccelerator 0.9.4 doesn't support PHP 5.1, I anxiously awaited the next version of eAccelerator that did support the latest version of PHP. I've tried a couple other PHP optimizers in the past, including Zend Optimizer and Alternative PHP Cache (APC) but I've never has the best of luck with anything but eAccelerator.

Last summer, I installed the release candidate of eAccelerator version 0.9.5. At the time I couldn't really get it to work that well with PHP 5.1. While eAccelerator showed up in the command line with a php -v, it never showed up under phpinfo(). The official version of 0.9.5 was released last month and to my dismay the stable release didn't fix my problems either.

I finally got fed up with eAccelerator not working correctly and did what all good system administrators do...I looked at the error logs and hunted down similar reports of this "bug". A check in the error logs found:

PHP Warning: PHP Startup: Unable to load dynamic library '../eaccelerator.so' - ../eaccelerator.so: undefined symb ol: _zval_ptr_dtor in Unknown on line 0

No matter how I recompiled eAccelerator on the server, I kept on returning to this same error in the logs. After some hunting, I found Ticket #61 which was closed more than six months ago. While the ticket was written for a different version of PHP and operating system than the one I was using, the ticket contained a similar error message to the one I posted above.

In short the solution was to make sure I recompiled PHP without versioning (remove '--enable-versioning'). Once I recompiled both PHP without versioning, eAccelerator worked the way I expected it to work.

To be honest, I'm not exactly sure what enabling versioning actually does (at least with any confidence to write an explanation in this post). This server hosts mainly Drupal and Wordpress applications and so far I haven't seen any ill effects to not include versioning when configuring PHP. If someone has a decent explanation as to why or why I don't need versioning I'd be glad to hear from you. When I get back into the office this week, I may have to check out my PHP references, as online explanations seem sketchy at best.

At his moment, CMS Report is now running on Drupal 4.7 and hosted on a server running PHP 5.1.6, MySQL 5.0, and eAccelerator 0.9.5. I know there are others more willing to go further, but that's about as close to the edge as I want to go for now. Except of course, upgrading this site in the near future to Drupal 5.0 Beta! Cheers...