Installing PHP PEAR Packages Using cPanel
PEAR (PHP Extension and Application Repository) packages are reusable PHP code libraries that simplify web development. With cPanel, you can install and manage PEAR packages directly from your hosting account without needing manual server configuration.
Why Use PEAR Packages?
Section titled “Why Use PEAR Packages?”- Speed up development with pre‑built PHP libraries.
- Add functionality such as XML parsing, database access, or caching.
- Manage packages easily through cPanel’s interface.
Steps to Install a PEAR Package
Section titled “Steps to Install a PEAR Package”1. Access the PEAR Installer
Section titled “1. Access the PEAR Installer”-
Log in to cPanel.
-
On the Tools page → Software section, click PHP PEAR Packages.
-
The PHP Extensions and Applications Package Installer page appears.
- Note the path where PEAR packages are installed — you’ll need this for updating your PHP include path.
2. Install a Package
Section titled “2. Install a Package”You can install PEAR packages in several ways:
-
Search for a package
Section titled “Search for a package”- Type the package name (e.g.,
XML) in the search box. - Click Go.
- Scroll down and click Install next to the desired package.
- Type the package name (e.g.,
-
Browse available modules
Section titled “Browse available modules”- Click Show Available Modules.
- Scroll through the list and click Install for the package you want.
-
Install by name
Section titled “Install by name”- Under Install a PHP Extensions and Applications Package, type the exact package name.
- Click Install Now.
3. Manage Installed Packages
Section titled “3. Manage Installed Packages”-
After installation, packages appear under Installed PHP Extension(s) and Application(s).
-
Options available:
- Update → Upgrade to the latest version.
- Reinstall → Reinstall the package if needed.
- Uninstall → Remove the package.
- Show Docs → View documentation for the package.
- Show System Installed Modules → See packages installed system‑wide.
4. Configure PHP Include Path
Section titled “4. Configure PHP Include Path”After installing a PEAR package, you must configure the PHP include path so your application can use it.
-
Add the path provided by cPanel to your PHP scripts.
-
Example:
ini_set("include_path", "/home/username/php");