[Skip to content]  [Text only]  [Accessibility]  [Sitemap]

SF Logo (home page link) phpSiteFramework

Creative Commons License



Installation - optional

This page documents additional, optional installation steps you may want to make.

Caching Installation

If you wish to use caching you will need to:

  • get PEAR working in your PHP install
  • install Cache_Lite as a PEAR package
  • turn on caching within SF

To get PEAR working in your PHP install is beyond the scope of this document; a couple of pointers though:

  • ensure PEAR directory is include'd in your base PHP include (default include for PHP is generally ".;c:/php/pear" or adjust this as necessary via your php.ini), and
  • if you have never used PEAR in your installation you will need to run c:/php/go-pear.bat (or similar, in a Win32 install) to get PEAR configured.

see also: PEAR Installation docs

Download and install Cache_Lite and as a PEAR package, again, beyond the scope of this document. If PEAR install is all ok you should be able to just run something like:

  • c:/php/pear install c:/cache-lite/package.xml or
  • c:/php/pear install Cache_Lite-1.7.1.tgz

see also: PEAR CLI install docs

To turn on caching within SF:

  • ensure PEAR directory is include'd in your PHP includes for your installation (default install will be something like "php_value include_path .;c:\php\pear;[DocumentRoot]\testsite\_SF_modules")
  • open the SF_cacheconfig.php file and
    • change $SF_caching=false; to $SF_caching=true;
    • make a directory the web server has write access to for your cache files (e:/wwwtemp/cache or similar)
    • change the 'cacheDir' => 'e:/wwwtemp/cache/' settings to your new directory

Excluding files/directories from caching

There is always likely to be some areas you don't want SF to cache so a simple mechanism to exclude files, paths or part paths is available.

To add an exclusion, open SF_cacheconfig.php and edit the $SF_cacheexcludes array to contain the files, paths or part paths you wish SF to exclude from caching. See the next section on testing the cache to confirm your configuration is working.

Getting Cache status information

To get cache status information you can use available maintenance query strings. e.g for simple status use something like:


and then in the bottom right hand corner of the resulting page will be something like:

Page rendered in 0.0126 seconds (CachingOff)

Possible caching states are:

  • CachingOff (cache is turned off in SF_cacheconfig.php)
  • FromCache (page was cached and came from Cache)
  • CacheUpdateForced (page was processed regardless of Cache state and re-cached) - this is the result of using '?sf_f=force' query string
  • CacheExcluded (page is excluded from caching via SF_cacheconfig.php settings)

Protecting the SF 'admin' pages

If you haven't restricted access to _SF_modules using Allow/Deny in your httpd.conf then I recommended you do protect the 'admin' directory. There are no obvious risks presented via the admin pages but it should be considered best practice to restrict access to them.

_SF_modules/admin/ with a specific directory configuration in httpd.conf, something like:

 <Directory [DocumentRoot]/testsite/_SF_modules/admin/>
  #inherits everthing else from previous dir
  php_value auto_prepend_file none 
  #directory restrictions 
  Order Deny,Allow
  Allow from locahost


The Fitzwilliam Museum, University of Cambridge.

phpSiteFramework powered