Index: includes/database.mysql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v
retrieving revision 1.79
diff -u -p -r1.79 database.mysql.inc
--- includes/database.mysql.inc	29 Aug 2007 18:38:55 -0000	1.79
+++ includes/database.mysql.inc	25 Sep 2007 17:03:06 -0000
@@ -89,10 +89,16 @@ function db_connect($url) {
     drupal_maintenance_theme();
     drupal_set_header('HTTP/1.1 503 Service Unavailable');
     drupal_set_title('Unable to connect to database server');
+    if (ini_get('display_errors')) {
+      $db_connection_error_message = '<p>The MySQL error was: '. theme('placeholder', mysql_error()) .'.</p>
+<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>';
+    }
+    else {
+      $db_connection_error_message = '<p>To display more details about the Mysql error, the PHP setting display_errors must be on. You can change it by editing your <code>settings.php</code> configuration file in Drupal.</p>';
+    }
     print theme('maintenance_page', '<p>If you still have to install Drupal, proceed to the <a href="'. base_path() .'install.php">installation page</a>.</p>
 <p>If you have already finished installed Drupal, this either means that the username and password information in your <code>settings.php</code> file is incorrect or that we can\'t connect to the MySQL database server. This could mean your hosting provider\'s database server is down.</p>
-<p>The MySQL error was: '. theme('placeholder', mysql_error()) .'.</p>
-<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
+'. $db_connection_error_message .'
 <ul>
   <li>Are you sure you have the correct username and password?</li>
   <li>Are you sure that you have typed the correct hostname?</li>
@@ -105,9 +111,15 @@ function db_connect($url) {
   if (!mysql_select_db(substr($url['path'], 1))) {
     drupal_maintenance_theme();
     drupal_set_title('Unable to select database');
+    if (ini_get('display_errors')) {
+      $db_connection_error_message = '<p>The MySQL error was: '. theme('placeholder', mysql_error($connection)) .'.</p>
+<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>';
+    }
+    else {
+      $db_connection_error_message = '<p>To display more details about the Mysql error, the PHP setting display_errors must be on. You can change it by editing your <code>settings.php</code> configuration file in Drupal.</p>';
+    }
     print theme('maintenance_page', '<p>We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.</p>
-<p>The MySQL error was: '. theme('placeholder', mysql_error($connection)) .'.</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
+'. $db_connection_error_message .'
 <ul>
   <li>Are you sure you have the correct database name?</li>
   <li>Are you sure the database exists?</li>
Index: includes/database.mysqli.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.mysqli.inc,v
retrieving revision 1.44
diff -u -p -r1.44 database.mysqli.inc
--- includes/database.mysqli.inc	3 Sep 2007 17:02:16 -0000	1.44
+++ includes/database.mysqli.inc	25 Sep 2007 17:03:07 -0000
@@ -87,10 +87,16 @@ function db_connect($url) {
     drupal_maintenance_theme();
     drupal_set_header('HTTP/1.1 503 Service Unavailable');
     drupal_set_title('Unable to connect to database server');
+    if (ini_get('display_errors')) {
+      $db_connection_error_message = '<p>The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.</p>
+<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>';
+    }
+    else {
+      $db_connection_error_message = '<p>To display more details about the Mysql error, the PHP setting display_errors must be on. You can change it by editing your <code>settings.php</code> configuration file in Drupal.</p>';
+    }
     print theme('maintenance_page', '<p>If you still have to install Drupal, proceed to the <a href="'. base_path() .'install.php">installation page</a>.</p>
 <p>If you have already finished installed Drupal, this either means that the username and password information in your <code>settings.php</code> file is incorrect or that we can\'t connect to the MySQL database server. This could mean your hosting provider\'s database server is down.</p>
-<p>The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.</p>
-<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
+'. $db_connection_error_message .'
 <ul>
   <li>Are you sure you have the correct username and password?</li>
   <li>Are you sure that you have typed the correct hostname?</li>
@@ -103,9 +109,15 @@ function db_connect($url) {
   else if (mysqli_connect_errno() > 0) {
     drupal_maintenance_theme();
     drupal_set_title('Unable to select database');
+    if (ini_get('display_errors')) {
+      $db_connection_error_message = '<p>The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.</p>
+<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>';
+    }
+    else {
+      $db_connection_error_message = '<p>To display more details about the Mysql error, the PHP setting display_errors must be on. You can change it by editing your <code>settings.php</code> configuration file in Drupal.</p>';
+    }
     print theme('maintenance_page', '<p>We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.</p>
-<p>The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
+'. $db_connection_error_message .'
 <ul>
   <li>Are you sure you have the correct database name?</li>
   <li>Are you sure the database exists?</li>
Index: includes/database.pgsql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v
retrieving revision 1.61
diff -u -p -r1.61 database.pgsql.inc
--- includes/database.pgsql.inc	25 Sep 2007 11:44:35 -0000	1.61
+++ includes/database.pgsql.inc	25 Sep 2007 17:03:07 -0000
@@ -85,10 +85,16 @@ function db_connect($url) {
     drupal_maintenance_theme();
     drupal_set_header('HTTP/1.1 503 Service Unavailable');
     drupal_set_title('Unable to connect to database');
+    if (ini_get('display_errors')) {
+      $db_connection_error_message = '<p>The PostgreSQL error was: '. theme('placeholder', decode_entities($php_errormsg)) .'</p>
+<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .', the username is '. theme('placeholder', $url['user']) .', and the database server is '. theme('placeholder', $url['host']) .'.</p>';
+    }
+    else {
+      $db_connection_error_message = '<p>To display more details about the PostgreSQL error, the PHP setting display_errors must be on. You can change it by editing your <code>settings.php</code> configuration file in Drupal.</p>';
+    }
     print theme('maintenance_page', '<p>If you still have to install Drupal, proceed to the <a href="'. base_path() .'install.php">installation page</a>.</p>
 <p>If you have already finished installed Drupal, this either means that the username and password information in your <code>settings.php</code> file is incorrect or that we can\'t connect to the PostgreSQL database server. This could mean your hosting provider\'s database server is down.</p>
-<p>The PostgreSQL error was: '. theme('placeholder', decode_entities($php_errormsg)) .'</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .', the username is '. theme('placeholder', $url['user']) .', and the database server is '. theme('placeholder', $url['host']) .'.</p>
+'. $db_connection_error_message .'
 <ul>
   <li>Are you sure you have the correct username and password?</li>
   <li>Are you sure that you have typed the correct hostname?</li>
Index: sites/default/default.settings.php
===================================================================
RCS file: /cvs/drupal/drupal/sites/default/default.settings.php,v
retrieving revision 1.3
diff -u -p -r1.3 default.settings.php
--- sites/default/default.settings.php	28 Aug 2007 11:42:56 -0000	1.3
+++ sites/default/default.settings.php	25 Sep 2007 17:03:08 -0000
@@ -146,6 +146,7 @@ ini_set('session.save_handler',     'use
 ini_set('session.use_only_cookies', 1);
 ini_set('session.use_trans_sid',    0);
 ini_set('url_rewriter.tags',        '');
+# ini_set('display_errors',           0);
 
 /**
  * Drupal automatically generates a unique session cookie name for each site
