Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.41
diff -u -p -r1.41 install.php
--- install.php	13 Apr 2007 08:56:57 -0000	1.41
+++ install.php	6 May 2007 00:44:13 -0000
@@ -17,6 +17,10 @@ require_once './includes/install.inc';
 function install_main() {
   global $profile, $install_locale;
   require_once './includes/bootstrap.inc';
+  $settings_file = './'. conf_path() .'/settings.php';
+  // If the settings file exists but is unreadable, try to change the
+  // permissions so that it is readable (i.e. the web server is the owner).
+  drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE);
   drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
   require_once './modules/system/system.install';
   require_once './includes/file.inc';
@@ -87,7 +91,6 @@ function install_main() {
   drupal_install_profile($profile, $modules);
 
   // Warn about settings.php permissions risk
-  $settings_file = './'. conf_path() .'/settings.php';
   if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
     drupal_set_message(st('All necessary changes to %file have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.', array('%file' => $settings_file)), 'error');
   }
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.163
diff -u -p -r1.163 bootstrap.inc
--- includes/bootstrap.inc	30 Apr 2007 14:37:36 -0000	1.163
+++ includes/bootstrap.inc	6 May 2007 00:44:13 -0000
@@ -266,7 +266,18 @@ function conf_init() {
   global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile;
   $conf = array();
 
-  include_once './'. conf_path() .'/settings.php';
+  $settings_file = './'. conf_path() .'/settings.php';
+  if (!($exists = file_exists($settings_file)) || !is_readable($settings_file)) {
+    // settings.php was unreadable or does not exist.
+    drupal_maintenance_theme();
+    drupal_set_title('Cannot read settings');
+    print theme('maintenance_page', '<p>The configuration file '. theme('placeholder', $settings_file) . ($exists ? ' is unreadable. Please add read permissions to the file using chmod or another file utility.' : ' does not exist. Please check that all files were downloaded and copied correctly.') .'</p>
+<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
+    exit;
+  }
+  else {
+    include_once $settings_file;
+  }
 
   if (isset($base_url)) {
     // Parse fixed base URL from settings.php.
