When running a non-interactive installation script to install a sub directory multisite instance I get the following error message:

Database name field is required.
Database username field is required.
Exception: Database name field is required. Database username field is required. in install_run_task() (line 414 of /home/micro2/public_html/includes/install.core.inc).

Here is my installation script code.

// The settings for the installer to use when installing Drupal.
$settings = array(
  // This overrides the PHP array $_SERVER so we can tell Drupal
  // the path to the site. This is important for multi-site support.
  'server' => array(
    'HTTP_HOST' => 'micro2.newcollege.ac.uk',   // The domain name.
    'SCRIPT_NAME' => '/micro2test/install.php',          // The path to the site on the domain.
  ),

  // Select the profile and the locale.
  'parameters' => array(
    'profile' => 'minimal',
    'locale' => 'en',
  ),

  // The values to use in each of the forms.
  'forms' => array(
    'install_settings_form' => array(
   'driver' => 'mysql',
'mysql' => array (
      'database' => 'database',
      'username' => 'username',
 'password' => 'password',
      'host' => 'localhost',
'port' => '3306',
),
    ),

    // The site configuration form.
    'install_configure_form' => array(
      'site_name' => 'Webserver',
      'site_mail' => 'email@example.com',
      'account' => array(
        'name' => 'admin',
        'mail' => 'email@example.com',
        'pass' => array(
          // On the form there are two password fields. The installer is filling
          // out the form so we need to fill in both form fields.
          'pass1' => 'password',
          'pass2' => 'password',
        ),
      ),

      // The default country and timezone.
      'site_default_country' => 'US',
      'date_default_timezone' => 'America/Detroit',

      // Enable clearn URLs.
      'clean_url' => FALSE,

      // Check for updates using the Update manager.
      // Possible values are:
      //  - array() = off,
      //  - array(1) = check for updates,
      //  - array(1, 2) = check for updates and notify by email
      'update_status_module' => array(1, 2),
    ),
  ),
);

/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());

/**
* Global flag to indicate that site is in installation mode.
*/
define('MAINTENANCE_MODE', 'install');

// Load the installer and initiate the install process using $settings.
require_once DRUPAL_ROOT . '/includes/install.core.inc';
install_drupal($settings);


When I use the same code on my local Mac dev environment it works no problem, but when I try it on our test server it fails. I don't think its the mysql user credentials, as i'm able to install the same site fine using the interactive installer.

Comments

Version: 7.31 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.