Skip to content

Installing and enabling PHP extensions in DirectAdmin

Any PHP extension available on PECL can be installed and enabled on any PHP version supported by DirectAdmin. This guide uses memcache on PHP 7.4 as an example — adjust the PHP version paths and download URLs for your specific extension.

For built-in extensions that don’t require compilation, see Enabling PHP extensions with DirectAdmin.

Log in to your compute via SSH as root, then download and extract the extension:

cd /tmp
wget https://pecl.php.net/get/memcache-4.0.5.1.tgz
tar -zxvf memcache-4.0.5.1.tgz
cd memcache-4.0.5.1

DirectAdmin stores PHP binaries at /usr/local/phpXX/bin (e.g., /usr/local/php74/bin for PHP 7.4).

Run phpize to prepare the build environment:

/usr/local/php74/bin/phpize

Configure the extension:

./configure --with-php-config=/usr/local/php74/bin/php-config

Compile and install:

make
make install

The output will show the extensions directory, e.g.:

Installing shared extensions: /usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/

Verify the .so file is present:

ls -la /usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/

Open the PHP configuration file for your version (e.g., /usr/local/php74/lib/php.ini) and:

  1. Find extension_dir (typically commented out by default). Uncomment it and set the path:

    extension_dir = "/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/"
  2. At the end of the file, add:

    extension=memcache.so
  3. Restart the web server:

    systemctl restart httpd.service
  4. Verify the extension is loaded:

    /usr/local/php74/bin/php -m