[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


For Manual Installation from the source code

I am getting an error. Do you know how to handle this:

/usr/local/lsws/lsphp81/bin/pecl install zip

PHP Warning: PHP Startup: Unable to load dynamic library ā€˜zipā€™ (tried: /usr/local/lsws/lsphp81/lib64/php/modules/zip (/usr/local/lsws/lsphp81/lib64/php/modules/zip: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib64/php/modules/zip.so (/usr/local/lsws/lsphp81/lib64/php/modules/zip.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
downloading zip-1.21.1.tgz ā€¦
Starting to download zip-1.21.1.tgz (358,030 bytes)
ā€¦done: 358,030 bytes
24 source files, building
running: phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
building in /usr/local/lsws/lsphp74/tmp/pear-build-rootCFCGc4/zip-1.21.1
running: /usr/local/lsws/lsphp74/tmp/zip/configure --with-php-config=/usr/local/lsws/lsphp81/bin/php-config
checking for grep that handles long lines and -eā€¦ /bin/grep
checking for egrepā€¦ /bin/grep -E
checking for a sed that does not truncate outputā€¦ /bin/sed
checking for pkg-configā€¦ /bin/pkg-config
checking pkg-config is at least version 0.9.0ā€¦ yes
checking for ccā€¦ cc
checking whether the C compiler worksā€¦ yes
checking for C compiler default output file nameā€¦ a.out
checking for suffix of executablesā€¦
checking whether we are cross compilingā€¦ no
checking for suffix of object filesā€¦ o
checking whether we are using the GNU C compilerā€¦ yes
checking whether cc accepts -gā€¦ yes
checking for cc option to accept ISO C89ā€¦ none needed
checking how to run the C preprocessorā€¦ cc -E
checking for iccā€¦ no
checking for sunccā€¦ no
checking for system library directoryā€¦ lib
checking if compiler supports -Wl,-rpath,ā€¦ yes
checking build system typeā€¦ x86_64-pc-linux-gnu
checking host system typeā€¦ x86_64-pc-linux-gnu
checking target system typeā€¦ x86_64-pc-linux-gnu
checking for PHP prefixā€¦ /usr/local/lsws/lsphp81
checking for PHP includesā€¦ -I/usr/local/lsws/lsphp81/include/php -I/usr/local/lsws/lsphp81/include/php/main -I/usr/local/lsws/lsphp81/include/php/TSRM -I/usr/local/lsws/lsphp81/include/php/Zend -I/usr/local/lsws/lsphp81/include/php/ext -I/usr/local/lsws/lsphp81/include/php/ext/date/lib
checking for PHP extension directoryā€¦ /usr/local/lsws/lsphp81/lib64/php/modules
checking for PHP installed headers prefixā€¦ /usr/local/lsws/lsphp81/include/php
checking if debug is enabledā€¦ no
checking if zts is enabledā€¦ no
checking for gawkā€¦ gawk
checking for zip archive read/writesupportā€¦ yes, shared
checking libzipā€¦ yes
checking PHP versionā€¦ 8.1/8.2
checking for pkg-configā€¦ /bin/pkg-config
checking for libzipā€¦ configure: error: system libzip must be upgraded to version >= 0.11
ERROR: `/usr/local/lsws/lsphp74/tmp/zip/configure --with-php-config=/usr/local/lsws/lsphp81/bin/php-configā€™ failed

What are you trying to do here? You cannot configure a module with different php version for another php version. Do you want to install for php7.4 ? Use php7.4 in all your commands etc

I want to configure zip for php8.1 with this command: /usr/local/lsws/lsphp81/bin/pecl install zip
I donā€™t know why it comes up with the lsphb74.

Did you do this part

I just did that, restarted and I am still getting these:

checking for libzipā€¦ configure: error: system libzip must be upgraded to version >= 0.11
ERROR: `/usr/local/lsws/lsphp74/tmp/zip/configure --with-php-config=/usr/local/lsws/lsphp81/bin/php-configā€™ failed

I rebuilt the server with almalinux 8 and now everything is working as it should