Information for: DEVELOPERS   PARTNERS

Acquia require line

Applications on Acquia Cloud Platform load a specific set of global configurations to ensure minimum basic operations are fulfilled. For environments running on Cloud Classic infrastructure, this code exists in your application’s settings.php file and appears 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 $db_url
// (Drupal 5 or 6) or $databases (Drupal 7 or 8) 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.

  • For environments running on the Cloud Classic infrastructure (for example, RA or CD environments), you must add the require line in settings.php.

  • For environments running on Acquia Cloud Next technologies, you don’t need to explicitly add the require line in settings.php.

    Important

    By default, all Acquia Cloud Next environments have the require line at the bottom of the settings.php file. 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 in settings.php is set to ../config/default. 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 a custom value: /tmp/john.

    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'] = '/tmp/john';
    

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.