Development and databases
Use PEAR packages in existing PHP applications
PEAR distributes PHP libraries that some applications still use. If a project depends on one of those packages, you can manage it from PHP PEAR Packages in cPanel when that feature is available. For new dependencies, check whether the project uses Composer.
Find and install a package
- Open PHP PEAR Packages in cPanel.
- Search for the exact name given in the application's documentation.
- Check the version, whether it is maintained and its compatibility with the PHP the project uses.
- Install it and review the result and any dependencies that were added.
A package being in the catalogue does not guarantee that it is still maintained or that it works with every PHP version. Do not update a component shared by several applications without testing them first.
Add the search path
cPanel shows where it installs your account's components, usually /home/usuario_cpanel/php. Use the path your installation shows.
If you only need to add it for one script, keep the existing paths too:
<?php ini_set('include_path', '/home/usuario_cpanel/php' . PATH_SEPARATOR . get_include_path());
Replace the username and then load the specific file the package requires, according to its documentation. If you set it from the PHP selector, check that the option is available and consider its effect on other applications that use that version.
Check or remove a package
Test the application feature that uses it and check the log if PHP cannot find a file or a dependency. Check the website's effective path and PHP, which may differ from the terminal's.
Before uninstalling, find out which projects load it. Moving to Composer requires adapting the project's installation and autoload; installing Composer does not automatically replace the require or include statements of a legacy application.
You may also find useful
- Change PHP options with the selector or .htaccess Change supported PHP directives from the cPanel selector or, when the handler allows it, with php_va...
- Change a website's PHP version with checks and rollback Change a website's PHP version, or your hosting's default version, from the client area, with a comp...
- Different PHP versions per directory or domain Assign a different PHP version to a website or any folder from the client area or with AddType in .h...
- PHP binary paths for each version Use the absolute path of each PHP version's binary when running cron jobs, commands or scripts that...
Something wrong or out of date? Tell us and we will review it.