Installing PEAR on Site5

I wanted to try caching PHP generated content using the Cache_Lite module from the PEAR repository. This micro-guide might save someone trying the same thing a few minutes of hunting for information.

After ssh’ing into Site5 or other webserver:

% pear -s -c ~/.pearrc -d doc_dir=~/pear/docs \
-d ext_dir=~/pear/ext -d php_dir=~/pear/lib \
-d data_dir=~/pear/data -d test_dir=~/pear/tests \
-d cache_dir=~/pear/cache -d bin_dir=~/pear/bin
% pear install -o -n PEAR

Append to ~/.bashrc as follows (assuming bash is the default shell):

PATH=~/pear:$PATH

Then

% source .bashrc
% pear install Cache_Lite

The PHP to include the module:

<?php
    $path = '/home/myusername/pear/lib';
    set_include_path(get_include_path().
        PATH_SEPARATOR . $path);
    require_once('Cache/Lite.php');
?>

Leave a Reply


Bad Behavior has blocked 824 access attempts in the last 7 days.