Introduction
Sometimes PHP scripts require additional modules that need installing that are not included in Easy Apache 4. In these cases, PECL needs to be used.
Procedure
WHM
To install a PHP PECL module from WHM, navigate to "Module Installers" then click "Manage" next to "PHP PECL"
Next, select the PHP version you'd like to install a module for.
You can use the search functions to view available modules, or, if you know the exact name of a module, you can enter it in the "Install a PHP PECL" field and click "Install"
If you get an error, you can review the Unable to Install a Module Using PECL article
For more information on this interface, please see the documentation
Command-Line
To install a PHP module, you use the pecl command/ EasyApache 4 includes multiple versions of PHP, so there is a different command for each PHP version. As an example, here is the PECL location for PHP 7.2 and PHP 7.3:
/opt/cpanel/ea-php72/root/usr/bin/pecl
/opt/cpanel/ea-php73/root/usr/bin/pecl
To install a module, you would use the pecl install command:
/opt/cpanel/ea-php73/root/usr/bin/pecl install xmldiff
In the above example, I installed the PECL package xmldiff. At the end of the installation process, the extension is added to the /opt/cpanel/ea-php73/root/etc/php.d/zzzzzzz-pecl.ini file. If you get an error, you can review the Unable to Install a Module Using PECL article
[root@source ~]# cat /opt/cpanel/ea-php73/root/etc/php.d/zzzzzzz-pecl.ini
extension="xmldiff.so"
[root@source ~]#
You can confirm the PHP extension was installed using the PHP command through the command line:
[root@source ~]# /opt/cpanel/ea-php73/root/usr/bin/php -m | grep xmldiff
xmldiff
If you're using CloudLinux you will need to update the CageFS filesystem so users will be able to see the extensions:
cagefsctl --update