Cloud Platform

Acquia require line

Applications on Cloud Platform load a specific set of global configurations to ensure minimum basic operations are fulfilled. This configuration exists in your application’s settings.php file and looks similar to the following:

// On Cloud Platform, this include file configures Drupal to use the correct
        // database in each site environment (Dev, Stage, or Prod). To use this
        // settings.php for development on your local workstation, set $databases
        // (Drupal 7 or 9+) as described in comments above.
            if (file_exists('/var/www/site-php')) {
                require('/var/www/site-php/myapp/myapp-settings.inc');
            }

where myapp is the docroot of your website.

You must add the require line in settings.php.

Important

The require line includes files and such files include variables with specific values. To override such values, you must add your custom values for the variables after the require line.

For example, by default, the config_sync_directory value is set to sites/default/files/config_xxxxx. To change this value, you must include the require line and add your custom line to override the system-defined value. The following code snippet shows how you can override the system-defined value for config_sync_directory with config directory above your docroot.

if (file_exists('/var/www/site-php')) {
           require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-settings.inc';
          }
$settings['config_sync_directory'] = $app_root . '/../config/' . basename($site_path);
Important

Any modifications made to the settings.php file should be placed after this require line. Modifications made before the require line may be overridden by Acquia’s required file.

The file added by the Acquia require line performs the following functions:

  • Ensures that a valid version of Drupal core is installed.
  • Determines what version of Drupal core is in use.
  • Establishes the trusted host patterns for Drupal.
  • Establishes the Memcached infrastructure and connection information.
  • Builds all of the database connection information.
  • Suppresses error reporting in the production environment.
  • Sets the location of temporary files, including the Twig caches.