---
title: "Managing sites.php and settings.php"
date: "2025-11-07T06:38:58+00:00"
summary: "Manage Drupal sites.php and settings.php files in MEO. Learn how to configure multisites and use site-specific settings."
image:
type: "page"
url: "/acquia-cloud-platform/add-ons/multi-experience-operations/managing-sitesphp-and-settingsphp"
id: "8216ed12-f8d0-4364-bc7c-831a31f5902b"
---

Multi-Experience Operations (MEO) allows you to fully manage your Drupal `sites.php` and `sites/default/settings.php` files in your code repository. Unlike Site Factory, which uses `factory-hooks` that allows you to inject your custom logic, MEO's approach requires you to include a specific `require` line in your files. This allows you to add your own custom logic before or after the core configuration of the platform is loaded.

How MEO manages multisites
--------------------------

MEO is designed to use a single `docroot/sites/default/settings.php` file for all sites in your codebase. When a request comes in, the configuration files automatically set a variable (`$_ENV['AH_DRUPAL_SITE_NAME']`) that identifies the correct site. The `settings.inc` file uses this variable to dynamically load the correct database credentials and file paths for the requested site. This allows you to add new sites through the MEO user interface without needing to commit new code for each site.

Configuring `sites.php`
-----------------------

To ensure your MEO codebase connects correctly, create or edit the file at `docroot/sites/sites.php` and add the following lines: 

    <?php 
    
    // You can add custom logic before the include. 
    
    if (file_exists('/var/www/site-php')) { 
     require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-sites.inc'; 
    } 
    
    // You can add custom logic or overrides after the include.

The preceding snippet loads the platform-generated array of domain-to-site-name mappings.

Configuring `settings.php`
--------------------------

To ensure your MEO application connects correctly, edit the file at `docroot/sites/default/settings.php` and add the following lines, typically at the end of the file:

    <?php 
    
    // You can add custom logic before the include. 
    
    if (file_exists('/var/www/site-php')) { 
     require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-settings.common.inc'; 
    } 
    
    // You can add custom logic or overrides after the include.

Using a site-specific `settings.php` file
-----------------------------------------

While the default method uses `sites/default/settings.php` for all sites, MEO also supports site-specific overrides. If a file exists at `docroot/sites/<site-name>/settings.php`, Drupal loads that file instead.

If you use this method, you must manually set the `$AH_DRUPAL_SITE_NAME` PHP variable before the `require` line.

Note

The `$_ENV['AH_DRUPAL_SITE_NAME']` variable is not populated until after the `require` line is executed. This variable identifies the correct database.

For example, `docroot/sites/site2/settings.php`:

    <?php 
    
    // Manually define the site name for the platform include. 
    $AH_DRUPAL_SITE_NAME = 'site2'; 
    
    // ... (Your custom settings for site2) 
    
    // Load the MEO-managed platform settings. 
    if (file_exists('/var/www/site-php')) { 
     require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $AH_DRUPAL_SITE_NAME . '-settings.inc'; 
    }