Support Centre

Using PEAR Modules

Not enough ratingsNot enough ratingsNot enough ratingsNot enough ratingsNot enough ratings

Article

Preface

PEAR modules should be installed within your website rather than globally onto the server itself, the advantage this provides primarily is portability; you'll be able to move your website between different hosting servers without needing to reinstall these modules, as they'll be contained within your website.

For the sake of simplicity, we're going to pretend we need the module Crypt_Blowfish in this guide. Simply replace all references of the example module name with the one you're looking to use.


Locating the Module

The first step is to locate the module you need on the official PEAR website. You can find the module either by browsing or by using the search box on the home page. Once you've found your module, you should end up on a page that looks like this:

PEAR Website

Installing the Module

Click the Download tab at the top and select the "Download For manual installation only" option. This will download a .tgz file to your computer which you can then extract with your favourite archiving program. If you don't already have a program to open this type of file then 7Zip is probably easiest to use due to the wide array of file types it supports and it's free.

Once extracted, you'll end up with a folder named something along the lines of module_name.module_version. Inside that folder are the files you need.

Now create a folder within your website, we'll be using this to store the PEAR modules so to keep things simple we'll name the folder pear.


Setting Up Your Website

Next step is to tell your website that you want to look in that folder for modules. If you're using Plesk 11 or higher, skip down past this paragraph to "Plesk 11+ Notice".

What you'll need to do is modify your website's .htaccess file (or create it if one doesn't yet exist) and then add the following line:

php_value include_path ".:/var/www/vhosts/example.org/httpdocs/pear/"

(you'll need to replace example.org with your actual domain name)

Plesk 11+ Notice: If you're on Plesk 11 or above then instead of amending your .htaccess file, you should configure this setting through Plesk. Please see this article on how to change your PHP settings in Plesk 11 and above. You will want to set the include_path option in Plesk to ".:/var/www/vhosts/example.org/httpdocs/pear/" (without quotes, replacing example.org with your actual domain name).


Installing the PEAR Base

The last part is the most important, actually providing the base PEAR files. Download the PEAR base modules from the PEAR site here and here, installing them the same way you did for your module, by copying the contents of the downloaded archive into the newly created "pear" folder that you added to your hosting space earlier.

You should now have a pear folder that looks something like this (again using Blowfish as the example module I'm installing):

File Layout

And that's it. Both PEAR and the Blowfish PEAR module should now work within your website.


Additional Modules

If you need to install any additional modules in future, just follow the initial parts of this guide again: Download the module, extract it, upload it to your PEAR folder. No other additional configuration will be needed.

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed