Installing PEAR and PEAR Modules

From Lunarpages Web Hosting Wiki

Can I install my own copy of PEAR or other PEAR modules? Should I install my own PEAR?

Why would you want to install your own copy of PEAR or other PEAR packages? There are several good reasons to do so.

1. You can install the latest version.

2. Your application will be more portable.

If you want other PEAR libraries such as DB.php or SOAP, you will need to add them to your own space yourself.

On our shared hosting servers, you do not have access to shell. You will need to use FTP to upload the files to your own hosting space.

How to Install PEAR Modules

1. Download what you need from Some packages may depend on others so you may need more than one file.

2. Extract the files.

3. Create a new folder under your account root folder called "pear" (without the quotes and on the same level as public_html)

4. Upload all files under the pear folder. Please be aware that when a module is named something like Auth_SASL, SASL is a submodule for the Auth module hence the actual SASL files and folders belong under the Auth folder, Mail_MIME is a submodule of Mail hence the MIME files and folders go under the Mail folder, etc. Drop any version numbers in the folder names.

5. Create php.ini under public_html with the line:

include_path = .:/usr/local/lib/php:/home/username/pear (change username to your cPanel username)

6. Add a line to .htaccess:

suPHP_ConfigPath /home/username/public_html (change username to your cPanel username)

To use a PEAR library in an application you would add the following line:

require_once 'packagename.php'


require_once 'packagesubfolder/packagename.php'

Remember, our servers are case-sensitive. You must use the exact names.

To use a PEAR file that is already installed on the server, either skip to step 5 or add the path to pear (/usr/local/lib/php) into your file.