DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

Install PECL extension for PHP an easy way

| 13:00:32 18.12.2018

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

Let's Start

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.

PHP and GeoIP

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

PHP and memcached

For memcached extension you will need to install memcachedmemcached-devellibmemcached-devellibmemcached 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

PHP and Redis

 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!

Important

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. 

Tags: directadmin PHP PECL 
About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable expirience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.




All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition