0

I succeeded to install drupal 7.22 on my production server but still fail to have it running on my local EasyPHP running on win7 64b.

At database configuration step of the install process I have the following message:

Warning: in DatabaseConnection->__construct() (line 304 of C:\Program Files (x86)\EasyPHP-5.3.2i\www\drupal-7.22\includes\database\database.inc).
In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.
Failed to connect to your database server. The server reports the following message: .

You might note that no error message is actually reported.

The mentionned line 304 is opening the connection:

// Call PDO::__construct and PDO::setAttribute.
parent::__construct($dsn, $username, $password, $driver_options);

I verified db name, credentials, and other settings by connecting on the database with MySQL Workbench which succeed to connect to db.

I tried editing myself the default.settings.php:

$databases = array(
  'driver' => 'mysql',
  'database' => 'drupal-7.22', 
  'username' => 'datagrmdb', 
  'password' => 'mypassword',
  'host' => 'localhost',
  'port' => 3306,
  'prefix' => 'drupal_',
  'collation' => 'utf8_general_ci', // also checked that DB is configured this way
);

but that still failed.

I tried editing settings.php directly and reloaded the install process to continue but it stop saying that "Database is already installed". It suggest to empty the db but it is already empty.

Back to drupal wizards I also tried using 127.0.0.1 instead of localhost and setting 3306 manually but that did not changed.

There is another drupal database (another version) in mysql but I assume that should not cause any problem.

EDIT: I verified php_pdo.dll and php_pdo_mysql.dll exist in the php/ext directory

Any hint?

1
  • 2
    Try creating a simple PDO connection outside of Drupal - can you connect using that?
    – Clive
    Jul 31, 2013 at 19:27

1 Answer 1

1

Thanks Clive for the suggestion.

Writing www/test_pdo.php:

<?php
try{
    $dbh = new pdo( 'mysql:host=127.0.0.1;port=3306;dbname=drupal-7.22',
                    'mydb',
                    'mypassword',
                    array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
    die(json_encode(array('outcome' => true)));
}
catch(PDOException $ex){
    die(json_encode(array('outcome' => false, 'message' => 'Unable to connect')));
}
?>

proved the connection worked for "127.0.0.1" but not for "localhost", my initial setting.

So I changed sites/default/settings.php and reloaded and that worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.