Installing and configuring PEAR packages
Learn how to install and configure PEAR (PHP Extension and Application Repository) packages.
PEAR (PHP Extension and Application Repository) packages are reusable PHP code libraries that can greatly simplify web site development. There are PEAR packages for interacting with databases, handling e-mail, processing XML, and much more.
Install a PEAR package
Before you try to install a PEAR package, make sure it is not already installed. For example, our shared hosting servers already have several PEAR packages that are pre-installed systemwide. To see which PEAR packages are currently available for your web account, log in using SSH and then type the following command:
pear list
If the PEAR package that you want is not listed, then you can install it using one of the following methods.
Note
Hosting.com does not support installation of PECL (PHP Extension Community Library ) modules in our shared hosting environment. PECL modules can only be installed on VPS and Dedicated hosting accounts.
Method #1: Use cPanel
If your account includes cPanel, you can use it to install PEAR packages. For information about how to install PEAR packages using cPanel, please see this article.
After the PEAR package is installed, you must configure the PHP include path. See the Configure the PHP include path section below.
Method #2: Submit a support ticket
If you have installed PEAR packages before on other systems, you may have used the pear install command. However, this command requires superuser access, which is not available on shared hosting accounts. If you are unable to install a PEAR package using cPanel, our Support team can install it for you. If you need further assistance, please open a support ticket at https://my.hosting.com.
After the PEAR package is installed, you must configure the PHP include path. See the Configure the PHP include path section below.
Configure the PHP include path
After you install a PEAR package for the first time using one of the methods above, you must configure the PHP include path. Otherwise, your PHP script files will be unable to locate the PEAR packages that you installed. After you configure the PHP include path, you do not need to do so again for subsequent PEAR package installations.
Note
If you are using pre-installed systemwide PEAR packages in your code, you do not need to follow this procedure. This procedure only applies to PEAR packages that you have installed yourself.
To configure the PHP include path:
-
If you do not already have a custom php.ini file in the directory where your script file is located, set one up now. For information about how to set up a custom php.ini, please see this article.
-
Open the php.ini file and locate the line that starts with:
include_path
-
Add the PHP extension path. For example, if the existing line is:
include_path = ".:/usr/lib/php:/usr/local/lib/php"
Change the line to:
include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/USERNAME/php"
-
You can now include the PEAR package in script files located in the same directory.
More Information
For more information about PEAR packages, please visit http://pear.php.net.
Related Articles
Updated 3 days ago