When doing PHP configurations to Linux hosting, you may have to install PHP extensions for all versions. To do that, you will have to run the installer for each individual version.
To Install a PHP Extension
1. Install a PHP module by running the pecl command:
1 2 |
/opt/cpanel/ea-php72/root/usr/bin/pecl /opt/cpanel/ea-php73/root/usr/bin/pecl |
EasyApache 4 offers multiple versions of PHP. The command for each PHP version is different as shown in the above example with the PECL location for PHP 7.2 and PHP 7.3.
2. Install a module using the pecl install command:
1 |
/opt/cpanel/ea-php73/root/usr/bin/pecl install xmldiff |
To Install Multiple PHP Extensions
Loop through each PHP version and run the installer with the command:
1 |
ls /opt/cpanel/ea-php{72..80}/root/usr/bin/pecl 2>/dev/null | while read phpversion; do $phpversion install xmldiff; done |
The code you see above is to loop through PHP versions from 72 through 80 while installing xmldiff for each of them.
You can take that as an example to install a single PHP extension or multiple PHP extensions at once using PECL on a Linux server.