Ispmanager 6 lite, pro, host documentation

Install a PHP extension manually

 

Note
This method is not applicable for installing PHP extensions in CloudLinux.

Native PHP version

Execute the command below to install an extension for the native PHP version:

CentOS

yum install <package name>

Debian

apt install <package name>

Alternative PHP version

You can install an extension for the alternative PHP version:

  • using the package manager Pecl;
  • from the source code.

Install an extension using the package manager Pecl

Extension installation example:

  1. Install the packages:

    CentOS

    yum install autoconf gcc zlib-devel

    Debian

    apt install autoconf gcc zlib1g-dev
    Note.
    Additional packages may be required when you install other extensions.
  2. Install the extension:
    /opt/<PHP version directory>/bin/pecl install <extension name>
  3. Connect the extension for a required PHP version:
    echo extension=<extension name> >> /opt/<PHP version directory>/etc/php.d/<extension name>.ini
    For example:
    echo extension=memcache.so >> /opt/<PHP version directory>/etc/php.d/<extension name>.ini

Install from the source code

Let's install env as an example::

  1. Download and extract the archive with the extension source code:
    cd /tmp
    wget -O env.tar.gz http://pecl.php.net/get/env
    tar xzvf env.tar.gz
    cd env-0.2.1/
  2. Run the configuration and setup process:
    /opt/<version directory PHP>/bin/phpize
    ./configure --with-php-config=/opt/<PHP version directory>/bin/php-config && make && make install
  3. Enable the extension globally for the required PHP version:
    echo 'extension=env.so' > /opt/<PHP version directory>/etc/php.d/20-env.ini
Note.
The extension setup process may require additional packages that are not described in this article.