Hello!
This tutorial is an extension of Install/Uninstall PHP Extensions (pun not intended) for users who do not find the PHP extensions they need under Server > PHP > Install Extensions or find the module they need in the LiteSpeed repository.
PEAR package manager can also be used to to manage PECL extensions.
# change lsphp74 to any php version you have installed as default
$ cd /usr/local/lsws/lsphp74/bin
$ wget http://pear.php.net/go-pear.phar
$ ./lsphp go-pear.phar
then, using zip extension for example, run:
# install latest version of zip
$ /usr/local/lsws/lsphp74/bin/pecl install zip
# install specific version of zip
$ /usr/local/lsws/lsphp74/bin/pecl install zip-1.21.1
In your website create a php file e.g. info.php with the following contents:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
Run the file e.g. http://mywebsite.net/info.php
You should expect this result:
If you need to install any other extension find them here and here or run this command:
# change zip with any package you want to lookup
$ /usr/local/lsws/lsphp74/bin/pecl search zip
For PEAR extensions configure the extension after installation:
UBUNTU
$ sudo echo "extension=imagick.so" >> /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/40-imagick.ini
ALMALINUX
$ sudo echo "extension=imagick.so" >> /usr/local/lsws/lsphp74/etc/php.d/40-imagick.ini
Restart PHP
Option 1: Go to https://SERVER_URL/managephp/installExtensions > Choose the PHP version you installed extensions for > Click on Restart PHP
Option 2: In SSH Terminal run command touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt && systemctl restart lsws