Installing PHP Extension Manually - ISPmanager

To install the native PHP version, use the command:

CentOS

yum install <package_name>

Debian

apt install <package_name>

You can use the Pecl package manager or source code to install an alternative PHP version.

To install an alternative PHP version using the Pecl package manager (for example, for a memcache application):

  1. Install packages (may require other packages depending on the extension):
    1. CentOS
      yum install autoconf gcc zlib-devel
    2. Debian
      apt install autoconf gcc zlib1g-dev
  2. Install the extension:
    /opt/<PHP_version_directory>/bin/pecl install memcache
  3. Connect the extension:
    echo extension=<extension_library_name> >> 
    /opt/<PHP_version_directory>/etc/php.d/<extension_name>.ini

To install an alternative PHP version using source code (for example, for the env extension):

  1. Download and unzip the file with the source code of the required extension:
    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 configuration and build:
    /opt/<PHP_version_directory>/bin/phpize

    ./configure --with-php-config=/opt/<PHP_version_directory>/bin/php-config &&
    make && make install
  3. Include the extension for the required PHP version:
    echo 'extension=env.so' > /opt/<PHP_version_directory>/etc/php.d/20-env.ini