You can configure the PHP settings for each of your Acquia Cloud environments.
To change an environment's PHP settings, complete the following steps:
- Sign in to the Acquia Cloud interface, and then select the application that you want to configure.
- Click the name of the environment that you want to configure, and then click Configure.
- 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.
- 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 (recommended) - The latest version of PHP 7, 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 max execution time
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.
In the Configuration panel, use the Max execution time slider (or enter a value in the number field), and then click Save.
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 (Acquia Cloud Professional only)
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.
Use the PHP memory slider (or enter a value in the number field) to increase or decrease the PHP memory limit, and then click Save. Click Reset to default to reset to the default setting, 128 MB 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 128M 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.
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 opcode cache size (Acquia Cloud Professional only)
Using an opcode cache 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.
Use the slider to increase or decrease the PHP opcode cache size (or enter a value in the number field), and then click Save. The PHP opcode cache is shared among all processes. Click Reset to default to reset to the default setting, 96 MB.
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
$_COOKIE inputs. The default value is 1000.
Use the slider to increase or decrease the maximum number of input variables (or enter a value in the number field), and then click Save.
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 256 MB. Larger sized POSTs are more susceptible to failure.
Use the slider to increase or decrease the maximum size of a POST request (or enter a value in the number field), and then click Save.