Adding non-Drupal PHP extensions or libraries to your website

The Acquia Cloud platform includes a standard set of PHP extensions that are available on all servers. Your application might, however, require additional PHP extensions to support its own desired features. If you have an Acquia subscription that entitles you to file support tickets, you can compile and deploy your own PHP extensions or libraries, and then Acquia can enable them on your site's environments.

Apache serves everything in the /docroot directory and ignores files that are not in /docroot. Your repository contains a /library subdirectory that you can use for PHP code libraries. (This is located in the / directory of Git repositories and in the /trunk directory of SVN code repositories.) The /library subdirectory is part of your default PHP include_path and is outside of /docroot, so it will not be served by Apache.

If any PHP library does not work as expected, examine your website's php-error.log. Acquia does not guarantee that any PHP extensions used in this manner will function as expected, and we will not assist with troubleshooting extensions that do not function as expected. Also note the limitations under Unsupported software.

Compiling PHP libraries

You must compile the PHP extensions (.so files) and libraries that you require and commit them to your code repository. Acquia does not provide support for this process. You must compile them for the same operating system version that your Acquia Cloud environments are running. To determine the operating system, connect to your environments with SSH and run this command:

lsb_release -c

Check for dependencies

The compiled PHP extension must contain any dependent libraries not already found on your server. To test this, navigate to the PHP extension's folder in your /library directory on your server and run ldd, making sure to replace with the name of the actual .so file you've compiled.

Here is an example of a compiled extension that does not have the required libraries on the server or statically linked to the compiled extension:

sitename@server-1234:/var/www/html/$ ldd =>  (0x00007fff071ff000) => not found => /lib/x86_64-linux-gnu/ (0x00007f2ea56b5000)
/lib64/ (0x00007f2ea5c92000)

Note that one of the requirements was not found.

Deploying PHP extensions

You must deploy the version of code that contains this change to whichever environments you need the code to be enabled on. For example, if you commit your code to the master branch, the extension can be enabled only on environments running master or a branch or tag pulled from master after the change was submitted. Otherwise, the files will be missing.

To use a custom PHP library called my.php on your website, commit it to the /trunk/library directory in your SVN repository or the /library directory in your Git repository, and then use the following statement in your Drupal code, in the file where you make a call to the custom library:

include_once "my.php";

Enabling PHP extensions

Once you have compiled and deployed your PHP extension, you need to get it enabled on your Acquia Cloud environments. To do so, file a ticket with Acquia Support. The ticket must specify the location of the compiled extensions, as well as a very brief summary of their intended purpose. Once Acquia has reviewed and approved the request, we will modify the php.ini files in your environments to point to each compiled extension in your code repository. This typically takes one or two business days.

Enabling PHP IMAP or xdebug

The PHP IMAP and xdebug extensions are present, but disabled by default on Acquia Cloud. If you want to use either PHP IMAP or xdebug, you don't need to compile and deploy it. You need only to file an Acquia Support ticket and request that it be enabled.

Unsupported software

Acquia Cloud does not support the following software:

  • Moodle (not compatible with high availability)
  • piwik (we've repeatedly seen this cause performance issues)
  • Any non-Drupal CMS
  • CA Single Sign-on (formerly CA SiteMInder)

You cannot install the following software on Acquia Cloud:

  • Custom daemons or services, such as Jabber, node.js, or Microsoft Exchange.
  • Custom package installations that require apt-get. Note that you may still install custom executables using your code repository.

Related topics

Sign in to vote or comment