APC (Alternative PHP Caching http://us.php.net/manual/en/book.apc.php) is a memory based opcode caching system which supports variable caching inside of php scripts. It’s among 3 major opcode cachers for PHP (the other two are XCache and EAccelerator). While APC sounds great (after all, to install it all you need to type is `pecl install apc`), it suffers from a few major flaws. My personal feeling, is that these flaws warrant its removal from PECL. Read more to see why APC sucks so bad…
No support for FastCGI
FastCGI is the best available SAPI for performance (which is what APC is suposed to improve). There is no notice anywhere on APC’s site, or on the APC area of php.net that it’s not compatible with FastCGI. However, there are warnings on the internet not to use APC with FastCGI (and to use XCache instead). I decided to test it myself. It installs fine, and runs ok. For a while. Then it segmentation faults. A lot. It’s actually quite sad, that a PECL extension has this much instability…
No command line support
Now, I’m not saying that memory should persist on the command line (that’s not possible), but the functions themselves shouldn’t be disabled! Right now, APC disables the internal variable caching mechanisms when PHP is executed as CLI. This makes things like Unit Testing (which are normally done from the command line) exceedingly difficult. IMHO, it should run just the same via CLI as in any other SAPI…
Limited support
APC works completely with 5.2.x… It does not have a full implementation in 5.3.x yet, and has no support for 6.0 at this time. XCache has full support for 5.3.x, and has alpha support for 6.0!
No late binding support!
APC does not provide caching for included files which are included on a conditional basis ($var = ‘myfile.php’; require_once($var);). This means that php needs to compile all these files for you (The main reason to install APC in the first place was to avoid compiling)! XCache doesn’t have this problem…
APC is so far inferior to XCache in so many critical aspects, that I really wonder why it’s still in PECL, and XCache isn’t… Makes you wonder…
|