Configuration changes with Drupal on IIS 7

Categories:

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.

UPDATE: Microsoft have released an update for FastCGI on IIS 7 that addresses this issue. Please read this article for more information.

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;
}

Now save the file and you should be able to manage your Drupal site as per normal. I'll update this article again when news of a hotfix for this issue is released.

Average rating
(3 votes)

Comments

Anonymous's picture

I was struggling to install

I was struggling to install drupal 6.10 on godaddy windows hosting account. Started thinking about purchasing one more account with linux hosting.

But, was fortunate enough to come across this article. It works like a charm with IIS7 and I am running drupal on windows godaddy account now.

Thanks Brashquido!!!!

Brashquido's picture

Glad I could help

That is good to hear. However Microsoft released a fix some time ago for FastCGI that should have fixed this issue. Perhaps godaddy just haven't applied the fix? Either way, at least your up and going.

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

worked for me also.

I was also struggling with content that wouldn't save after trying to get Drupal 6.12 running on my GoDaddy Windows hosting account. This worked great, although I found the code to tweak in the bootstrap.inc file (not bootstrap.php).

Thanks!

Anonymous's picture

thanks a lot

It works for me thanks a lot.

Anonymous's picture

Thanks a lot

I needed this because the hotfix has not been released for Windows 7 (yet hopefully), however the problem still exists.

Brashquido's picture

phpinfo

You shouldn't have this issue with FastCGI on IIS 7.5 as it is using an updated version. Check your file versions against the ones listed in this article, and if your files are newer then this is not your issue. You could also create a phpinfo file to show you what value is being reported for REQUEST_URI.
----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster