Installing XCache on Ubuntu and Apache to cache php


Using XCache can improve the performance of a web site, by caching PHP.

From the XCache project page: "XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load."

It works the same way as other PHP cachers such as APC.

Remember to also benchmark your web site before and after installing XCache, to be able to determine if it makes a difference in the performance of the server.

Installing and configuring XCache

sudo apt-get install php5-xcache

Enable the admin interface by copying the files to your web site directory

cp -a /usr/share/xcache/htdocs /var/www/public/xcache

Generate a password, in this case the very unsecure "nimda", it should of course be a much stronger password

echo -n "nimda" | md5sum

Insert the resulting MD5-hash in the config file

sudo vi /etc/php5/apache2/conf.d/20-xcache.ini

Edit the file to look like this

xcache.admin.enable_auth = On
xcache.admin.user = "admin"
xcache.admin.pass = "ee10c315eba2c75b403ea99136f5b48d"

Access the admin interface

Benchmark your web site with Apache Benchmark tool, try running it before and after installation of XCache

ab -c5 -n3000