[TUTORIAL] How to install any PHP modules using PEAR Package Manager


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:


// Show all information, defaults to INFO_ALL

// Show just the module information.
// phpinfo(8) yields identical results.


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:


$ sudo echo "extension=imagick.so" >> /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/40-imagick.ini


$ 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

1 Like

Hello Joseph,

I am trying to install mail, mail_mime and mail_mimedecode

These are the commands i have run

cd /usr/local/lsws/lsphp74/bin

wget Source of ', htmlspecialchars($_GET['viewsource']), '

./lsphp go-pear.phar

/usr/local/lsws/lsphp74/bin/pear install mail

/usr/local/lsws/lsphp74/bin/pear install mail mail_mime

/usr/local/lsws/lsphp74/bin/pear install mail mail_mimedecode

All installed however in my php.ini they do not show installed
i have also run php -m and again they do not show installed.
running the install commands again shows they are installed already.

Hello @craig

Kindly check the tutorial I have added how to configure PEAR extensions after installation.

Thanks Joseph,

All now working :+1:
Initially i thought i still had an issue but realised my php file needed the path to php changing.
If anyone else needs it in the future the path to php is