PHP PECL Packages: How to View and Install
What are PHP PECL Packages?
PECL (PHP Extension Community Library) is a repository for PHP extensions, providing a directory of all known extensions and hosting facilities for downloading and developing PHP extensions.
How to View Currently Installed PECL Packages
To view the PECL Packages currently installed, you will need SSH access. If you need to enable SSH access, please see our article, SSH Access.
There is currently no way for an individual cPanel user to view installed PECL packages. Instead, you can check where installed packages are within your ~/pecl folder.
You can view globally installed PECL packages by using the following command (73 can be replaced with any other available version of PHP ex. 56, 70, 71, 72, 73, and 74):
ea-php73-pecl list -a
How to Install PECL Packages
You can download and install PECL packages locally to your account. You'll need SSH access. If you need to enable SSH access, please see our article: SSH Access.
Note: Instances of "ea-php73" in the following commands can be replaced by other versions of PHP on the server.
Once you're logged in, these are the steps for installation:
- Create a folder in your home directory to download and compile the packages.
mkdir ~/pecl
- Create a directory for your PHP extensions to be located in. Something like ~/php/extensions.
$ mkdir ~/php )
$ mkdir ~/php/extensions
- Change directories to that created PECL directory, and run the following command:
c
$ cd ~/pecl
$ /opt/cpanel/ea-php73/root/usr/bin/pecl download <packagename>For multiple PECL packages, repeat steps 4-9 and then step 12.
- That will download the package, which you'll then need to untar with:
tar –zxvf $package.tgz
- Change directories to the extracted directory and run the phpize command:
$ cd ~/pecl/
$ /opt/cpanel/ea-php73/root/usr/bin/phpize
- Once done, run the following command from inside the module folder:
/opt/cpanel/ea-php73/root/usr/bin/phpize && ./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config --prefix=$HOME/pecl/
- If that runs without error, the package should be compatible with our environment. If it completes successfully, run the following command from the individual module directory.
make
- That will create the module file you must put in your php.ini. It'll be located in the modules directory and named <packagename>.so.
- Copy the .so file to your ~/php/extensions directory you created.
cp ~/pecl//modules/.so ~/php/extensions/
- Copy the existing server-installed extensions from /usr/lib64/php/modules/ to the ~/php/extensions directory:
cp -rf /usr/lib64/php/modules/* ~/php/extensions/
- Edit your PHP config from within the Advanced section, then MultiPHP INI Editor. Use the Editor mode to add the following line or edit the existing line.
You can find your /home/user folder using the "pwd" command in the shell.
extension_dir = "/home<#>//php/extensions"
- Add the extension to your php.ini file. It'll look like:
extension=.so
Summary
This guide will take you through the process of understanding PECL packages, how to check which ones are currently installed, and how to install them in your PHP. Although it may require SSH access to view installed packages, we have provided a helpful tip for locating them in your ~/pecl folder. PECL packages can be installed by downloading and compiling them locally to your account. With some effort, you can easily install PECL packages and enhance your PHP experience.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.