IIS7 | Drupal install with fastcgi

Published by

Posted on January 24, 2010

OMG!!!!

Ok that was out of the way. performing a Drupal install for the first time using IIS version 7 and windows 2k8 server. After entering the database information I was faced with a 500 error message that gave me a lot of information. SIKE

The 500 error gave me nothing at all, did not tell me where the error was or which file caused the error. By default IIS7 will suppress the PHP errors and will not show them in the browser. This is the case even if Display_errors is turned on in the php.ini file.  I had to enable the directive to save the error to a flat file error_log= /path

some techs have enabled enabled IIS7 errors server wide using
%windir%\system32\inetsrv\appcmd.exe set config -Section:system.webServer/httpErrors -errorMode:Detailed

Issue 1
If you have tried installing Drupal on Windows Vista or Server 2008 recently with PHP configured to use Microsoft’s FastCGI handler, then you will have no doubt encountered a problem where you are unable to make any updates to your site configuration. This is because the REQUEST_URI variable when using Microsoft’s FastCGI handler on IIS 7 does not include the query string as it does with other Web servers such as Apache. Until the IIS team release a fix for this you’ll need to use a work around to rectify the issue.

The easiest way to rectify the issue at the moment is to modify the request_uri() function in Drupal. To do this simply open the Drupal bootstrap file in “includes/bootstrap.php” find the appropriate section of code and modify as follows;


function request_uri() {

/* Comment out the condition that uses REQUEST_URI server variable
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
}
else { */
if (isset($_SERVER['argv'])) {
$uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['argv'][0];
}
elseif (isset($_SERVER['QUERY_STRING'])) {
$uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
}
else {
$uri = $_SERVER['SCRIPT_NAME'];
}
// }

return $uri;
}

Then I found i was receiving the error

isssue 2 :
Fatal error: Trying to clone an uncloneable object of class mysqli in db-mysqli.php

Fix : “Fatal error: Trying to clone an uncloneable object of class mysqli – If this error occurs you must turn off the zend.ze1_compatibility_mode setting in your PHP configuration.”

ini_set(‘zend.ze1_compatibility_mode’, 0);

Issue 1 can be fixed by having your administrator install the M$ path or upgrade to SP2
Patch

Dont forget to read the install docs