Configure Xcache on your linux server.

Now that you have installed Xcache its time to configure it for your server. If you haven’t set it up yet then install Xcache first.

You have the default config so I will show you what I use and why. Open your php.ini file and edit it.


zend_extension = “/usr/local/lib/php/extensions/no-debug-non-zts-20090626/xcache.so”
zend_extension = “/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so”

xcache.admin.enable_auth = Off          <——- If you have problems logging into the admin, set to off.
xcache.admin.user = “myname”
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = “md5ofwhateveryourpasswordis”


xcache.shm_scheme = “mmap”
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size = 256M                               <————-I have 4G of ram so I set it high.
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count = 8                                    <———–I have 8 processors
; just a hash hints, you can always store count(items) > slots
xcache.slots = 8K
; ttl of the cache item, 0=forever
xcache.ttl = 3600                                     <———–this is seconds, set to 0 if you dont want it to ever get deleted.
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval = 300

; same as aboves but for variable cache
xcache.var_size = 64M                               <———You dont have to set this.
xcache.var_count = 8                                <———–I have 8 processors
xcache.var_slots = 8K
; default ttl
xcache.var_ttl = 3600
xcache.var_maxttl = 3600
xcache.var_gc_interval = 300

xcache.readonly_protection = Off
xcache.mmap_path = “/dev/zero”

; make sure it’s writable by php (open_basedir is not checked)
xcache.coredump_directory = “”

xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off

xcache.test = Off
xcache.experimental = Off

xcache.coverager = Off

xcache.coveragedump_directory = “”

Restart apache when you are finished and look at a phpinfo.php file to verify that Xcache is working.

/etc/init.d/httpd restart

Admin panel setup

If you followed my first tutorial, you have the source files in the /opt dir. Copy the whole admin folder in the xcache folder to one of your websites public_html folders.

cp -Rf /opt/xcache-2.0.0 /home/your-user/public_html

Change the ownership of the folder and files to your apache user or cpanel user and make them executable.

chown -R user:user /home/your-user/public_html/admin

chmod +x  /home/your-user/public_html/admin

You should now be able to go into your admin folder and see your cache being stored by the site.


It should look similar to this. http://xcache.lighttpd.net/demo/admin/



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.