Configuring PHP settings

You can configure the PHP settings for each of your Acquia Cloud environments.

To change an environment's PHP settings, complete the following steps:

  1. Sign in to the Acquia Cloud interface, and then select the application that you want to configure.
  2. Click the name of the environment that you want to configure, and then click Configure.

    Configure an environment

  3. Use the PHP section to configure PHP for your application's needs. Click one of the following available PHP settings for information about the item, including configuration options.
  4. Click Save.

Configuring the PHP version

Your Drupal application runs on the PHP programming language. You can configure the version of PHP used by your application for each environment.

Which PHP version to use

Acquia Cloud offers the following versions of PHP for your applications' use:

  • Acquia PHP 7.1 (recommended) - The latest version of PHP 7.1, custom built for Acquia Cloud.
  • Acquia PHP 5.6 - The latest version of PHP 5.6, custom built for Acquia Cloud.

As a general principle, use the latest available version of PHP. Each new version of PHP includes both enhancements and bug fixes that can improve the performance and security of your Drupal application. However, you may be using custom or contributed Drupal modules that depend on an earlier version of PHP. Although this is not common, whenever you change your PHP version, you should always do so first on your Development or Stage environment — not on your Production environment — and test it to ensure that there are no compatibility issues.

Working with different PHP versions on different environments

Most PHP code should work fine on either PHP 5.6 or PHP 7. Some of your code may work on one version of PHP, but not with another version. If you plan on switching to a different version of PHP, do so first on your Dev or Stage environment and test it thoroughly before changing your production environment.

Advanced PHP settings

The following settings are for advanced users. For most applications, you should leave them at their default settings. Change them only if you are advised to do so by Acquia Support, or if you are confident that you know what you are doing. If you have Acquia Cloud Free, your application runs on a shared server, and you cannot configure your PHP settings. You can upgrade your Acquia Cloud Free subscription to a paid Acquia Cloud subscription.

Configuring any of the following values involves either using a setting's slider to modify the value in its field, or by directly entering values in the field. To return any of the following settings to their original value, click the Reset link by the value, and then click Save.

Configuring max execution time

By modifying the Max execution time field, you can configure the maximum amount of time any PHP process can take. If a PHP process does not complete in this amount of time, it fails and sends an error. This time limit helps to prevent PHP processes from becoming stuck and unavailable to serve new requests.

The default setting for PHP maximum execution time (300 seconds, or 5 minutes) is adequate for most Drupal applications on Acquia Cloud, and you should change it only when necessary.

The danger of allowing longer PHP maximum execution times is that individual page loads can occupy process slots for long periods of time, blocking other processes from using them.

Configuring PHP memory limit

The PHP memory limit is the maximum amount of RAM memory that a single PHP process can use. The memory used by the MySQL client counts against the PHP memory limit. The default setting for this value is 128MB per process.

The default setting for PHP memory is adequate for most Drupal applications on Acquia Cloud, and you should only change it when necessary. Increasing your PHP memory limit beyond 128MB on any one environment may reduce the number of PHP processes available to handle requests across all environments on your server. Your Drupal application can run out of PHP memory. If it does, you'll see an entry in the PHP error log stating that a process ran out of RAM memory.

If your application stops working and there is an Out of Memory error in the PHP log, increase the PHP memory in small increments until your application is working again, and then add a safety margin of additional memory. The maximum setting is 512MB per process. Contact Acquia Support if this setting needs to be higher.

If the Out of Memory error was caused by a one-time set of conditions (for example, enabling a large set of modules), reduce the PHP memory setting after the event. If you leave the PHP memory setting too high, you won't be able to run more than a few PHP processes on a machine without running out of RAM.

Configuring OPcache size

Using an OPcache significantly improves PHP performance. Since PHP is an interpreted programming language, each time a PHP script is called, it has to be reinterpreted. An opcode cache saves these scripts as machine code in memory the first time they are run, eliminating the time needed for reinterpretation on subsequent requests.

Acquia's test results indicate that using an opcode cache generally offers a three-fold to four-fold increase in performance. To improve application performance, Acquia Cloud implements opcode caching by default on all applications, using OPcache.

The PHP OPcache is shared among all processes, and its default size is 96MB.

OPcache interned strings buffer

The Interned Strings buffer is the amount of the PHP OPcache memory that is reserved for storing strings in OPcache. The amount of memory allocated to the Interned Strings Buffer will reduce the total amount of memory available for PHP OPcache.

The default setting is 8MB. If your OPcache is set to 96, this leaves 88MB for normal OPcache usage. If you need to increase the interned strings buffer over 16MB, Acquia recommends increasing the OPcache by the same amount.

To set the Interned Strings buffer higher than 32MB, please contact Acquia Support.

APCu size

This sets the amount of memory allocated to APC User Cache. This is a smaller cache than PHP OPcache, and most applications will run well with the default value (32MB). Drupal 8 makes more use of the APCu cache as a local, short-term cache than previous versions of Drupal did.

To set a size higher than 96MB, please contact Acquia Support.

Maximum input variables (Acquia Cloud Professional only)

You can set the maximum number of input variables that can be accepted. This limit (the PHP max_input_vars setting) is applied separately to $_GET, $_POST, and $_COOKIE inputs. The default value is 1000.

You might want to change this value if your application includes very large or complex form inputs and you are getting PHP warnings about input variables exceeding the limit. The default value is 1000. The highest value you can set in the Acquia Cloud interface is 2500. If your application requires a higher value (or if you have an Acquia Cloud Enterprise application), you can file a ticket for Acquia to set a higher value. However, higher values can lead to security vulnerabilities, so we recommend that you do not set the value higher than 5000. As an alternative, you should consider redesigning your application's forms to be smaller and less complex.

Maximum size of POST request (Acquia Cloud Professional only)

You can set the maximum size of a POST that can be accepted (the PHP post_max_size setting). This value affects the maximum size of file uploads on your application. Generally, this value should be smaller than the PHP memory limit. The default value is 256MB. Larger sized POSTs are more susceptible to failure.

Contact supportStill need assistance? Contact Acquia Support