Index: trunk/wp-settings.php
===================================================================
--- trunk/wp-settings.php	(revision 3363)
+++ trunk/wp-settings.php	(working copy)
@@ -18,6 +18,11 @@
 
 unregister_GLOBALS(); 
 
+// On which page are we ?
+$PHP_SELF = $_SERVER['PHP_SELF'];
+if ( empty($PHP_SELF) )
+	$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+
 $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
 unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
 
@@ -118,8 +123,8 @@
 
 $wpdb->hide_errors();
 $db_check = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
-if ( !$db_check && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
-	if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
+if ( !$db_check && (!strstr($PHP_SELF, 'install.php') && !defined('WP_INSTALLING')) ) {
+	if ( strstr($PHP_SELF, 'wp-admin') )
 		$link = 'install.php';
 	else
 		$link = 'wp-admin/install.php';
@@ -142,7 +147,7 @@
 require (ABSPATH . WPINC . '/kses.php');
 require (ABSPATH . WPINC . '/version.php');
 
-if (!strstr($_SERVER['PHP_SELF'], 'install.php')) :
+if (!strstr($PHP_SELF, 'install.php')) :
     // Used to guarantee unique hash cookies
     $cookiehash = md5(get_settings('siteurl')); // Remove in 1.4
 	define('COOKIEHASH', $cookiehash); 
