Php – Xcache is enabled but but not caching

PHPxcache

I installed Xcache on a Debian 6 server, however despite it being activated, no pages are being cached.

Apache is installed via the repos, however PHP 5.4 and xcache are compiled from source. PHP is running as an Apache module.

When I view the diagnostics page in the admin section, it says that 'Enabling PHP Cacher' status is 'Error' as no pages have been cached and that I should set xcache.cacher to 'On', which I already have.

PHP output:

# php -v
PHP 5.4.10 (cli) (built: Feb 13 2013 16:50:20) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with XCache v3.0.1, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.0.1, Copyright (c) 2005-2013, by mOo

In addition, phpinfo shows that the XCache Cacher Module is enabled.

My xcache settings:

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =               64M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =                 0
xcache.gc_interval =           0
xcache.var_size  =            4M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300
xcache.var_namespace_mode =    0
xcache.var_namespace =        ""
xcache.readonly_protection = Off
xcache.mmap_path =    "/dev/zero"
xcache.coredump_directory =   ""
xcache.coredump_type =         0
xcache.disable_on_crash =    Off
xcache.experimental =        Off
xcache.cacher =               On
xcache.stat   =               On
xcache.optimizer =           On
[xcache.coverager]
xcache.coverager =           Off
xcache.coverager_autostart =  On
xcache.coveragedump_directory = ""

I'm a little stuck. There's nothing in the .htaccess file that would disable it, same goes for inside the VirtualHosts block. I'm not sure where to look next to solve this problem, as from what I can see, it should be working.

Best Answer

I noticed the same problem when xcache.mmap_path wasn't set — it looks like your's is set but make sure it's a writable directory. In my case (on OSX) I'm using:

xcache.mmap_path = /tmp/xcache
Related Topic