Install XCache

Celestial Lord

New Member
XCache is a utility that should substantially decrease server load if you serve dynamic web sites. Note that you must be using DirectAdmin in PHP-CLI mode to get any benefit.

shell> wget
shell> tar -xvf xcache-1.2.2.tar.gz

shell> cd xcache-1.2.2
shell> phpize

Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

shell> ./configure --enable-xcache
shell> make
shell> make install

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

You can obviously use any text editor for the following. I personally use JOE:

shell> joe -w /usr/local/lib/php.ini

Place the following in php.ini, before Zend:

;; install as zend extension (recommended), normally "$extension_dir/"
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
zend_extension_ts = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
;; For windows users, replace with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
; extension =
;; or win32:
; extension = php_xcache.dll

xcache.admin.auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""

xcache.shm_scheme =        "mmap"
xcache.size  =               32M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =              3600
xcache.gc_interval =         300

; Same as aboves but for variable cache
; If you don't know for sure that you need this, you probably don't
xcache.var_size  =            0M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

; N/A for /dev/zero
xcache.readonly_protection = Off

xcache.mmap_path =    "/dev/zero"

xcache.cacher =               On
xcache.stat   =               On

shell> /etc/init.d/httpd restart

If you'd like, type php -v, and you should see that XCache is now installed and operational.

PHP 5.2.8 (cli) (built: Feb 16 2009 03:01:18)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
Works great so far on my main server that has many different script configurations.

I also installed this on my clients server that runs vTiger, and let's just say it's purring ;)