By default all servers have the following Pear packages installed:

  • Archive_Tar
  • Auth_SASL
  • Console_Getopt
  • DB
  • HTML_Template_IT
  • HTTP_Request
  • Log
  • MDB2
  • MDB2_Driver_mysql
  • MDB2_Driver_mysqli
  • MDB2_Driver_pgsql
  • Mail
  • Mail_Mime
  • Mail_mimeDecode
  • Net_DIME
  • Net_Socket
  • Net_URL
  • Net_URL2
  • Net_UserAgent_Detect
  • PEAR
  • PEAR_Frontend_Web
  • SOAP
  • Structures_Graph
  • XML_RPC

The latest stable versions of Pear modules are installed on all  servers as a part of our Professional Pear Modules Hosting.

How to install an additional Pear package?

divider

You can easily install any additional Pear package. In this tutorial we will demonstrate how to install the Calendar Pear package.

STEP 1.First go to http://pear.php.net/ and search for Calendar:

STEP 2.The search will find the Calendar package with its Description: “A package for building Calendar data structures”. Follow the link to the Calendar packet home page.

STEP 3.There click on the link to the Download section and choose to download the latest version;

STEP 4.Once you have the package downloaded locally, you have to extract it. For this purpose use any popular archiver like Tar or Rar.

STEP 5.Now you should have a folder called Calendar-X.X.X. In order to simplify things we will rename it to Calendar.

STEP 6.Next connect to your account by FTP and create a directory called pear right in the home directory (it does not have to be in the webroot). Upload the Calendar directory inside the pear directory. You should upload any other Pear packages there.

STEP 7.Next tell PHP to include the local pear directory. This can be done by creating a file called php.ini and pasting the following source code into it:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/my_cPanel_username/pear";

Make sure you change my_cPanel_username to your actual cPanel username. Also the first two paths (/usr/lib/php:/usr/local/lib/php) should remain so that the default PHP libraries are loaded.

This php.ini file must be copied in each directory where pear packages are needed.

From this point on the Calendar Pear package will be available with the fixed path:

include 'Calendar/Calendar.php';

Of course, you could just place the Calendar.php in a directory and include it directly. However, this way you will end up with many hardcoded paths and confusion will be increased in case you plan to use more Pear packages.