Cpanel include PEAR Library. Configure Path

vicnumb Oct 14, 2012

Oct 14 2012 Published by under PHP & MySQL, Tricks

I have recently faced a problem, a website of mine was using PEAR DB.php library.
On a linux server without WHM or Cpanel it’s not a problem (at least for me) to configure paths and include PEAR libraries into php scripts just by name:

include_once('DB.php');

For cpanel based servers this include won’t work unltil you install your PEAR lilbraries and tell your local php configuration where the PEAR library is.

 

CPANEL PEAR libraries installation and configuration

 

1. Find and click on your cpanel “PHP PEAR Packages” icon

PHP PEAR Packages Cpanel Icon

 

2. Search the PEAR library you wish to install or browse the available libraries

Seacrh PEAR library or display available libraries form

 

3. Select the appropriate PEAR library and click the install button

Install PEAR library

 

4. Go back to PEAR libraries management page.
With a list of installed libraries. You may also see libraries installed on system, e.g. globally available libraries (if your library is installed globally, you won’t need to make all these steps, it will automatically include by name, see the top of this post)

Display installed PEAR libraries

 

5. On the same PEAR libraries management page, find the path where your local PEAR libraries are installed

PEAR Library Local PATH

 

6. And the last step. Go to PEAR library include path directive.
Insert before it a php configuration directive with the path to PEAR libraries

ini_set('include_path', 'path'); //PEAR libraries path directive
include_once('DB.php'); //include PEAR library directive

 

Your PEAR settings are available just for a single cpanel account. The other cpanel accounts will require a new PEAR configurations.

No responses yet

Leave a Reply