diff --git a/includes/install.inc b/includes/install.inc
index 3631c36..5410cc7 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -657,6 +657,28 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') {
   else {
     throw new Exception(st('Failed to open %settings. Verify the file permissions.', array('%settings' => $default_settings)));
   }
+
+  // Clear opcode cache.
+  try {
+    if (function_exists('opcache_invalidate')) {
+      opcache_invalidate(DRUPAL_ROOT . '/' . $settings_file);
+    }
+    if (function_exists('apc_delete_file')) {
+      apc_delete_file(DRUPAL_ROOT . '/' . $settings_file);
+    }
+    if (function_exists('wincache_refresh_if_changed')) {
+      wincache_refresh_if_changed(array(DRUPAL_ROOT . '/' . $settings_file));
+    }
+    if (function_exists('xcache_clear_cache')) {
+      xcache_clear_cache(XC_TYPE_PHP);
+    }
+    if (function_exists('eaccelerator_clear')) {
+      eaccelerator_clear();
+    }
+  }
+  catch (Exception $e) {
+    throw new Exception(st('Failed to clear the opcode cache for %settings. For the duration of the installation it is recommended to either disable the opcode cache, or reconfigure it to allow code changes to be seen immediately.', array('%settings' => $settings_file)));
+  }
 }
 
 /**
