How to install Xcache 1.3/2.0 on your server.

Xcache has proven itself to be a great piece of software to speed up your site drastically. With all of the reading that I have done, I have seen many users have problems to get it running. I have used the EasyApache install of Xcache but it never works right for me when its compiled into php. It loads the module but doesn’t actually cache the pages when you try to view the Xcache admin panel. I think that the best thing to do is install the admin panel to verify that the module is actually working or run apache benchmark tests.

You should also find out what php handler you are using. Xcache does NOT work with suPHP. I suggest using fcgi with suexec on. If you are a cPanel user you can check in the php and suexec configuration. You can also use EasyApache to recompile php with fcgi enabled.

Go download the Xcache source.

cd  /opt

wget http://xcache.lighttpd.net/pub/Releases/2.0.0/xcache-2.0.0.tar.gz

Here is the md5 if you want it. 0c903c2eb70e31cbc35ae66fdb750bdc *xcache-2.0.0.tar.gz

tar -zxvf xcache-2.0.0.tar.gz

cd xcache-2.0.0

Now you should be in the directory of all of the files. Now we will create the configure file. If you do not have a compiler you will have to enable it in cPanel/Virtualmin or intall one. “yum install cpp”. By default, cPanel has compilers enabled.


./configure –enable-xcache


make install

Time to add the Xcache settings into your php.ini. Locate your ini file first. 32 bit is usually in /usr/lib/php.ini. Mine is 32-bit CentOS so its in  /usr/lib/.

cat /opt/xcache-2.0.0/xcache.ini >> /usr/lib/php.ini            NOTE: Be sure to type “>>” or you will ruin your php.ini

Now you should have your config. of xcache at the bottom of the php.ini. You will need to move any zend extension above it to the below the Xcache config. Change the zend extension line zend_extension = “/usr/local/lib/php/extensions/non-debug-non-zts-2009XXXX/xcache.so”to match the folder your “xcache.so” went into. Mine is

zend_extension = “/usr/local/lib/php/extensions/no-debug-non-zts-20090626/xcache.so”

Use vim or whatever editor you want and make the changes to the php.ini. Now you can restart apache and see if the module loaded.

/etc/init.d/httpd restart

php -v

You should get an output like this now.

PHP 5.3.10 (cli) (built: Apr 26 2012 18:16:51)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with XCache v2.0.0, Copyright (c) 2005-2012, by mOo
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

Congrats you have installed Xcache successfully. Now its time to configure it. Configure Xcache



One Comment

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.