So, after dealing with APC and all the troubles and woes, I’ve finally decided to give xcache a go. I originally decided to go with APC as there were talks of it being included in php6. However, as php6 was backported to php5.4, APC support was dropped. Recently there have been discussions on including Zend’s Optimizer+ in PHP. However, this is discussion and Zend’s Optimizer+ appears to have been baked into their encoding plugin which I’m not interested in. So, XCache it is!

Upon the decision to go with XCache, I first tried installing the homebrew repo package. That didn’t go so well as that installed version 2.0 and also it flat out didn’t work. It’s quite possible that it was a version issue, and possibly also a php binary issue (I have 2 installed). So, I decided to compile it manually. The first step was to look for a quick guide from someone who had done this before. But as luck would have it, I couldn’t find one. So, while doing this myself, I figured I’d document the steps for others looking to do the same.</>

The first step is to download the src code from lighttpd’s site.

After downloading, you’ll want to run the following commands.

Keep in mind that I’m using homebrew’s install of php5.4. If you’re using another package you’ll want to customize your configure parameters accordingly.

The following assumes you’ve setup your homebrew php in your default $PATH accordingly


$ wget http://...(the release url)
$ tar -zxf xcache-*.tar.gz
$ cd xcache
$ phpize
$ ./configure --enable-xcache --with-php-config=/usr/local/Cellar/php54/5.4.8/bin/php-config
$ make

#note the installed extension path for your extension = "/path/to/xcache.so" after the following make install
$ sudo make install

Now that you’ve successfully installed the extension. You’ll want to edit your php config and add the extension path, restart php-fpm if you’re using FastCGI or Apache if you’re using mod_php.

After that’s been done, you should have xcache up and running.

Note that I had an issue with /dev/zero as the xcache.mmap_path path. I’ve set mine to /tmp/xcache instead. However, you might consider correcting this issue. I suspect it’s permissions related.

Some additional things you may wish to do is optimize your settings for best performance. In particular, you may with to increase the RAM allotment.

Also, in the source files, you’ll see an htdocs folder. If you copy this over to your web root and call the path to the cacher folder, you’ll be able to access the interface for viewing your xcache performance and more.

Best of luck!