12.4. JPCache
Another entry in the field of memory/disk caching solutions is JPCache. Unlike APC and eAccelerator, JPCache does not need to be compiled as a DSO or statically built into PHP itself. JPCache is actually written in PHP and is used with standard include and require statements.
JPCache works by storing the generated output of a PHP script to disk or in a SQL server, instead of saving the compiled state of each script. By caching the output in this manner, coupled with gzip content compression, you can achieve up to 80% or more bandwidth savings.
12.4.1. Installing JPCache
To get started with JPCache, the first thing you need to do is download a copy of the latest version at http://www.jpcache.com.
Next, extract the tar/gzip archive:
tar -xvzf jpcache.v2.tgz
The contents of this directory now contain the scripts you'll need to use JPCache. Place this folder wherever you like, as long it is accessible by the user Apache runs as. Make note of the full path to the location, as you'll need it when configuring the cache.
In the base directory of your JPCache folder, edit the jpcache.php file. Change the following line to point to the location where you placed the jpcache folder:
$includedir = "/path/to/jpcache-files";
For example, if you moved the extracted jpcache folder to /www/jpcache, you'd use the following value:
$includedir = "/www/jpcache";
Next, edit the jpcache-config.php file. Most important, you'll need to uncomment the line indicating what type of cache storage ...
Get Professional LAMP: Linux®, Apache, MySQL®, and PHP5 Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.