Saturday, October 5, 2013

PHP: XCache Don't and Won't Work on CLI

The makers of XCache, opcode cacher of PHP, decided not to support it on CLI. This is a design decision more than a defect. Here's more info http://xcache.lighttpd.net/ticket/317.

It's not the end of the world though, there are still options like Memcache, IPCS or APC that you can use for such. Also, so your CLI doesn't show any error messages, prevent it from being used by checking it's SAPI name.

if (function_exists('xcache_get') && php_sapi_name() != 'cli') {
        //xcache_get
        //xcache_set
}
  • Related Links Widget for Blogspot

No comments: