Pear Modules

By default all SiteGround servers have the following Pear packages installed:

  • Archive_Tar
  • Auth_SASL
  • Console_Getopt
  • DB
  • HTML_Template_IT
  • HTTP_Request
  • Log
  • Mail
  • Net_Socket
  • Net_URL
  • Net_UserAgent_Detect
  • PEAR
  • SOAP
  • Structures_Graph
  • XML_RPC

How to install additional Pear package?

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

Step 1. First we 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". We follow the link to the Calendar packet home page.

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

Step 4. Once we have the package downloaded locally, we have to extract it. For this purpose use any popular archivator (7zip).

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 similarly any other packages there.

Step 7. Next inform 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_user_name/pear";

Make sure to change my_user_name to your 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 put in each directory where pear packaegs 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. This way you will end up with many hardcoded paths and confusion will be increased in case you plan to use more Pear packages.

Following the above steps you can install other Pear packages and benefit from using static paths.

Please, feel free to contact us if you have any questions or recommendations about this tutorial at: tutorials 'at' siteground.com