WebGee DocsDocs
Development
Free migration + 30-day money-backSee how

Install PEAR packages

Add PEAR packages through cPanel's PHP PEAR Packages interface, and know that PEAR is largely superseded by Composer.

Install PEAR packages on your hosting account. Applies to shared, reseller and Premium hosting.

PEAR is largely obsolete. It has been superseded by Composer, which nearly all modern PHP libraries use and which resolves dependencies per project rather than per account. Use PEAR only for a legacy application that specifically requires it.

Through cPanel

  1. In cPanel, open PHP PEAR Packages under Software.
  2. Search for the package.
  3. Select Install.

Packages install into your home directory, and cPanel shows the include_path your scripts need.

Add the include path

PEAR packages are not found automatically. Either set it per script:

<?php
set_include_path('/home/cpaneluser/php:' . get_include_path());
require_once 'Package.php';

Or account-wide, in Select PHP Version → Options, by setting include_path — see Change your PHP version and settings.

The exact path is shown on the PHP PEAR Packages page. It differs by account, so use the one displayed rather than the example above.

Use Composer instead where you can

Composer is available over SSH and is the right tool for anything new:

cd ~/public_html
php -d allow_url_fopen=1 /usr/local/bin/composer require vendor/package

Dependencies install into vendor/ inside your project, with an autoloader — no include_path to configure, and no risk of one application's requirements conflicting with another's.

If a package will not install

  • It requires a PHP extension that is not enabled. Check under Select PHP Version → Extensions.
  • It needs compilation. Packages requiring a compiler cannot be installed on shared hosting. A VPS can.
  • It is abandoned. Many PEAR packages have not been updated in a decade. Check for a Composer equivalent first.

On this page

Hosted elsewhere?

Cloud Hosting

cPanel on NVMe storage, with LiteSpeed, free SSL and daily backups included.

See plansFree migration