Installation of PECL extensions for PHP can be done an easy way. Learn here how to do it in a server console as a superuser root.
Here you can find some basics and a description on how to complete it manually: https://help.poralix.com/articles/installing-a-pecl-extension-for-php-on-directadmin-server
First connect to a Directadmin server as root.
Then download a script:
cd /usr/local/directadmin/scripts/custom wget https://raw.githubusercontent.com/poralix/directadmin-utils/master/php/php-extension.sh -O php-extension.sh chmod 750 php-extension.sh ./php-extension.sh
If succeeded you will see the script usage (the current 0.7-beta version output):
Usage: ./php-extension.sh <command> <pecl_extension> [<options>] Supported commands: install - to install extension remove - to remove extension status - show status of an extension options: --ver=VER - to install a specified version of an extension --beta - to install a beta version of an extension --php=VER - to install extension for one PHP version digits only (only one version at a time): 52, 53, 54, 55, 56, 70, 71, 72, 73, etc
So now we can install PECL extensions. Please note in certain cases you will need to install dependences, for example.
If you want to install a GeoIP extension for PHP you will need first install GeoIP-devel and GeoIP packages (according to CentOS names), then you can run:
./php-extension.sh install geoip
You can check installation status with the following command:
./php-extension.sh status geoip
Run the command if you want to remove the extension:
./php-extension.sh remove geoip
For memcached extension you will need to install memcached, memcached-devel, libmemcached-devel, libmemcached packages (according to CentOS names), then run:
./php-extension.sh install memcached
You can check installation status with the following command:
./php-extension.sh status memcached
Run the command if you want to remove the extension:
./php-extension.sh remove memcached
For redis extension you will need to install redis
./php-extension.sh install redis
You can check installation status with the following command:
./php-extension.sh status redis
Run the command if you want to remove the extension:
./php-extension.sh remove redis
If you check the status now you should see:
# ./php-extension.sh status redis [Warning] The extension redis for PHP 56 not found! [Warning] The extension redis for PHP 72 not found!
And so on. The script does not provide details on why an installation fails, so if an installation fails you still will need to read its output.
I hope the script will make easier installing of PECL extensions for PHP on your servers.