Question
How do I install a PHP PECL module?
Answer
PECL modules can be installed per PHP version directly from WHM's PHP PECL Installer, or from the command line.
- Log into WHM as
root. - Navigate to Home / Software / Module Installers / PHP PECL.
- Select the target PHP version from the Select a PHP version dropdown and click Apply. This determines which PHP version the module is compiled and installed for.
- In the Find a PHP PECL search field, enter the module name and click the Go button.
From the search results, click Install next to the desired module.
Note: The module is compiled from source during installation, so this step can take a few minutes.
Once installation completes, confirm the module is loaded for that PHP version:
# /opt/cpanel/ea-php81/root/usr/bin/php -m | grep -i mongo
mongodb
- Log in to the server via SSH or WHM's Terminal as the
rootuser. Each installed version of PHP uses its own PECL installer. You find them in the following path where "##" is the numbered version of PHP:
# /opt/cpanel/ea-php##/root/usr/bin/pecl
Run the installer with the "install" flag and the name of the module you wish to install:
# /opt/cpanel/ea-php##/root/usr/bin/pecl install $module
Note: You need to replace
$modulewith the module you wish to install.You can confirm the installation by listing the PHP modules for the installed version:
# /opt/cpanel/ea-php##/root/usr/bin/php -m | grep $module
If you are using CloudLinux, rebuild CageFS so users can see the updated extensions:
# cagefsctl --update
Comments
0 comments
Please sign in to leave a comment.