Documentation
Use PHP Easy Cache Pro
if you want to make you PHP website faster.
Also use this script to speed up your WordPress Page.
You don't know what caching is?
Read this: cachingexplained.com
Actual Cached Pages
1. cache_5c05f41e2a5ead15f0377d3d5b491948_example-cache-on.php
Validity Period of Cache is set to 1 hour(s)
Empty the complete Cache
How to Use it
Take the cache.php file, open it in an editor, edit the 'CACHE_PATH' settings and include the cache.php file in your website. That's all. If you use the default setup, you only need to create a directory named 'cache' at the root folder of your webhosting. Save the cache.php file also in the root directory of you webhosting and you are ready to go if you have included the cache.php file in your project, like e.g.
<?PHP include 'cache.php'; // rest of page code
The way you turn the Cache Off for a special Page
<?PHP // don't insert the line: include 'cache.php'; // rest of page code
— or —
<?PHP // or insert: $nocache = 'on'; // before the include: include 'cache.php'; // rest of page code
Delete the Cache
If you run a dynamic website, change session variables or use User-Logins etc.
you need to delete the cached pages to refresh the content and see the changes.
<?PHP include 'cache-empty.php';
Set Cache Folder Path
Every Parameter is setup in the cache.php file. Change all settings as required.
// PATH of CACHE (absolute path recommended) define('CACHE_PATH', dirname(__FILE__).'/cache/'); // while $_SERVER['DOCUMENT_ROOT'] is your root directory path at your web host // e.g. http://www.example.com // If your project and the cache folder are not at the root path of server, // e.g. http://www.example.com/project/cache/ // Then cache folder path will be like below // define('CACHE_PATH', $_SERVER['DOCUMENT_ROOT'].'/project/cache/');
— or —
// if you have write permission to temp folder you can use this // ADVANTAGE: cache files can't be accessed by webvisitors define('CACHE_PATH', '/tmp/');
— or —
// relative path - not recommended define('CACHE_PATH', 'cache/');
Set Advanced Cache Parameter
Its defined in cache.php file. Change settings according to your need.
// PREFIX of CACHE define('CACHE_PREFIX', 'cache_'); // REMEMBER: WITHOUT ANY SLASHES! // KEEP CACHE x HOURS define('CACHE_TIME', 1); // REMEMBER: WITHOUT ANY QUOTES! // DO YOU USE STATIC PAGES? (TRUE=static Pages OR FALSE=dynamic Pages) define('CACHE_STATIC', FALSE); // REMEMBER: WITHOUT ANY QUOTES! // DO YOU USE ZLIB COMPRESSION (TRUE/FALSE) - http://www.faqs.org/rfcs/rfc1950.html define('CACHE_COMPRESS', TRUE); // FALSE=Faster - TRUE=Save Disk Memory // DELETE OLD CACHE RUBISH? (only if older than CACHE_TIME) define('CACHE_TIDY', TRUE); // FALSE=Faster - TRUE=Save Disk Memory // USE DEBUG MODE? (set to FALSE when everthing works fine) define('CACHE_DEBUG', TRUE); // (TRUE/FALSE) // PATH or URL to SCRIPT define('CACHE_SELF', $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']); // LOCALHOST // TRY THIS INSTEAD, IF YOU GET IN TROUBLE // define('CACHE_SELF', $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); // WEB
Requirements
This script does not make any use of any special function,
so it will work in nearly every server environment.
In case of any problems with specific hostings let us know immediately!.
PHP 4 or newer
zlib for gzip compression (optional)
WordPress
How to add PHP Easy Cache Pro to your WordPress Installation?
Quite simple: Download, install and activate the Header and Footer plugin for WordPress. Go to the options-page to configure the plugin and there to the 'Page header and footer' Tab. Here you see the second text box where you can add your code.
<?PHP include 'cache.php'; ?>
Simply copy and paste the <?PHP include 'cache.php'; ?>
into the
'Code to be added on HEAD section of every page' textarea-box and save the settings.
This code will now be output to you header and active your cache!
That's it!