HOW-TO Setup & Configure XCACHE Caching on PHP-FPM: VPS BIBLE




new password?
login
X
xcache caching image

This tutorial guide shows the process to compile, install & tweak XCache for Ubuntu/Debian servers running PHP-FPM to run automatically on reboot.

This XCache installation method is fully tested and works, including after a system reboot.

Whether you have compiled PHP-FPM using an Integrated or Separate method, the procedure is the same.

Setup Unmanaged VPS: The Ubuntu-Nginx Guide

Take your virtual private server from zero to hero

  .. from blank box to cute-as server ..  

with this easy-to-follow copy/paste guide.

22+ parts with video, here’s the index.

Change directory to where we’ll download the XCache source files:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

Now browse here to check for the latest XCache version.

Set the version using the export command, replacing the version 1.3.0 as appropriate:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

Compile XCache for PHP

And paste this lot to download, unzip, change directory, use PHP’s third party extension installer phpize to prepare the package, configure and install XCache.


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

Note the last line of the installation. Something like:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

.. you’ll want that path to link XCache with PHP in a moment.

Configure XCache Caching

Open PHP’s configuration file:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

.. append with this, changing XCache’s third party PHP extension path with the one you copied above (but keep the /xcache.so element at the end, huh!):-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

.. and paste this too, making changes in accordance with my configuration notes below:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

You can find out more about configuring XCache parameters here but, unless you’re a tweakaholic and for most of us, just consider the following points:-

If, like me, you’re running a Linode with 360MB of RAM – the Linode 360 plan, you can use the above configuration unchanged.

Otherwise, you may wish to change four values:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

The first two will be identical to each other, so that helps. The default is actually 60M, not 64M as shown above – call me fussy if you like – which I have amended to work with a Linode running 360MB of RAM (the Linode 360 plan). If you’ve got more RAM, you can probably increase the value but I would recommend asking at your VPS forums.


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

The second two values will also be the same, relating to the number of processors running on your server.

To find out the value paste this at the command line:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

.. changing the value. My Linode, for example, has four, which is jolly posh:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

Suitably tweaked, save and close the php.ini file.

Initiating XCache Automatically on System Reboot

Because we’ve incorporated the XCache configuration into PHP’s settings file, and because we set up PHP-FPM to initiate on system boot (if you followed either of the PHP-FPM tutorials here at vpsBible), XCache will start automatically too.

Finally, restart PHP to initiate XCache:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

And to check it’s working properly, create a webpage.php and paste within this code:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

.. now surf to that page and F3 search the page for your XCache variables.

.. And cash in, why not. Sorry.

Setup Unmanaged VPS: The Ubuntu-Nginx Guide

Take your virtual private server from zero to hero

with this easy-to-follow copy/paste guide.

“My local PC runs Windows” Show me for Linux/Mac

22+ parts with video, here’s the index ..

Manage Unmanaged VPS: Ubuntu-Nginx Administration

Already set it up? We’d best maintain it then.

Toggle to the ..  Ubuntu-Nginx Admin Index

Manage Unmanaged VPS: Ubuntu-Nginx Administration

Maintain your virtual private server with ..

.. cheatsheets, tutorials, tips & guides.

Head back to the ..  Ubuntu-Nginx Installation Index

Nginx Admin: In the Works ..

This lot’s marked for addition already:-

  • Setup or Edit DNS using Bind
  • Network Tools Troubleshooting Guide
  • The Comprehensive Permissions Guide
  • Configuring Nginx Rewrites
  • Custom Website Error Page
  • Setting up Cron Jobs
  • Rsync for Incremental Remote-to-Local Backup
  • Cron & Rsync for Automatic Backup
  • Cron & mysqldump for Auto DB Backup
  • Safeguard Bandwidth with Hotlink Protection
  • Block Access with Nginx’ IP Deny



Got a Question? Want to Comment?

This site has no comments system. We've got a better system!

Please use the link at the top of the post and goto this topic's forum thread:-

  • to help build community
  • for a superior knowledge base
  • to keep info in one place, not diluted between forum & comments.

For those posts ported from Guvnr.com (pre-Feb/2010), archive comments remain.

Handy info from these comments is in the process of being ported to the forum and attributed to the original author.

If you think this idea sucks, let me know.

Thank you.