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 your Acquia subscription, and then go to the Cloud > Workflow page.
- Open the menu for the environment you want to configure, and then click Configure.
In the PHP settings section, you can configure the following items:
- PHP version
- PHP max execution time
- PHP memory
- PHP opcode cache size
- Maximum input variables
- Maximum size of POST request
Configuring the PHP version
Your Drupal website runs on the PHP programming language. You can configure the version of PHP used by your website for each environment.
Which PHP version to use
Acquia Cloud offers these versions of PHP:
- Acquia PHP 5.6 (recommended)
The latest version of PHP 5.6, custom built for Acquia Cloud. Uses OPcache opcode cache, and includes the APCu extension for 100% compatibility with the APC user caching API. Note that under PHP 5.6, you cannot install Drupal 7 versions before Drupal 7.33.
- Acquia PHP 5.5 (deprecated)
As a general principle, use the latest available version of PHP. Each new version of PHP includes enhancements and bug fixes that can improve the performance and security of your Drupal website. However, you may be using custom or contributed Drupal modules that depend on an earlier version of PHP. This is not common; however when you change your PHP version, you should always do so first on your Dev or Stage environment, not on your Prod environment, and test it to make sure there are no compatibility issues.
To select the PHP version for an environment:
- Open the menu for the environment that you want to configure, and click Configure.
- Select the PHP version you want to use in that environment.
- Click Save.
Working with different PHP versions on different environments
Most PHP 5 code should work fine on PHP 5.6 or PHP 5.5. Some of your code might work on one version of PHP, but not work on a different version. For more information, see Common issues when upgrading Drupal 6.x and 7.x websites to PHP 5.5 or PHP 5.6 and Backward Incompatible Changes in the PHP documentation. If you plan to switch to a different version of PHP, you should do so first on your Dev or Stage environment and test it thoroughly.
If you deploy code from one environment to another, and the two environments use different versions of PHP, the Cloud > Workflow page displays a confirmation dialog. This is to help you remember to test your code under the new version of PHP.
Advanced PHP settings
The following settings are for advanced users. For most websites, 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 website runs on a shared server, and you can configure your PHP version, but not these advanced PHP settings. You can upgrade your Acquia Cloud Free subscription to a paid Acquia Cloud subscription.
Configuring PHP 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.
On the Configure Environment page, under PHP max execution time (secs), enter a value, in seconds, and click Save.
The default setting for PHP maximum execution time (300 seconds, or 5 minutes) is adequate for most Drupal websites 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 to increase or decrease the PHP memory limit. 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 websites 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 website 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 website stops working and there is an "Out of Memory" error in the PHP log, increase the PHP memory in small increments until your website 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 PHP 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 website performance, Acquia Cloud implements opcode caching by default on all websites, using OPcache.
Use the slider to increase or decrease the PHP opcode cache size. 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.
You might want to change this value if your website includes very large or complex form inputs and you are getting PHP warnings about input variables exceeding the limit. As an alternative, you should consider redesigning your website'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 website. 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.