XCache is a fast, stable ​PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest ​PHP release branches such as PHP_5_1 PHP_5_2 PHP_5_3 PHP_5_4. ThreadSafe/Windows is also perfectly supported. It overcomes a lot of problems that has been with other competing opcachers such as being able to be used with new ​PHP versions.

Download Latest Stable xcache Release

cd /usr/local/src/


tar -zxvf xcache-3.0.3.tar.gz

cd xcache-3.0.3

Use phpize command to prepare xcache as a PHP extension for compiling, if you dont know where is phpize, use find -name phpize.


Configure, compile and install xcache

./configure –enable-xcache


make install

You will received the following extension directory details.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20090626/

open php.ini and add xcache.so entries.

vi /usr/local/lib/php.ini


restart apache webserver.

/etc/init.d/httpd restart

Thats all!! you can verify that xcache modules in your php.

[email protected] [/]# php -v
PHP 5.3.25 (cli) (built: Jul  9 2013 23:42:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with XCache v3.0.3, Copyright (c) 2005-2013, by mOo
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
with XCache Cacher v3.0.3, Copyright (c) 2005-2013, by mOo
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

If you still need to optimize the xcache and configure admin settings then use the following settings in your php.ini file.

xcache.admin.user   = "admin"
;how to create md5 pwd: echo -n "password"| md5sum
xcache.admin.pass   = "5f4dcc3b5aa765d61d8327deb882cf99"

; Change xcache.size to tune the size of the opcode cache
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
; someone said, if >=64 will get problem

xcache.size         = 32M
xcache.shm_scheme   = "mmap"
; set to cpu count (cat /proc/cpuinfo |grep -c processor)

xcache.count        = 4
; just a hash hints, you can always store count(items) > slots

xcache.slots        = 8K
; ttl of the cache item, 0=forever

xcache.ttl          = 0
; interval of gc scanning expired items, 0=no scan, other values is in seconds

xcache.gc_interval  = 0

; Change xcache.var_size to adjust the size of variable cache
; same as aboves but for variable cache, if you have not used xcache function in script,forget it

xcache.var_size     = 8M
xcache.var_count    = 1
xcache.var_slots    = 8K
xcache.var_ttl      = 0
xcache.var_maxttl   = 0
xcache.var_gc_interval =     300

xcache.test         = Off
xcache.readonly_protection = On
; for *nix, xcache.mmap_path is a file path, not directory.
; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection
; 2 group of php won’t share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path

xcache.mmap_path    = "/tmp/xcache"
; leave it blank(disabled) or "/tmp/phpcore/"
; make sure it’s writable by php (without checking open_basedir)

xcache.coredump_directory =   ""
; per request settings

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

; per request settings
; enable coverage data collecting for xcache.coveragedump_directory and
; xcache_coverager_start/stop/get/clean() functions (will hurt executing performance)

xcache.coverager    = On
; ini only settings
; make sure it’s readable (care open_basedir) by coverage viewer script
; requires xcache.coverager=On

xcache.coveragedump_directory = ""
3.00 avg. rating (70% score) - 2 votes
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive