[HOWTO] Running unlimited sitemap generator on IIS webserver
« on: April 09, 2010, 12:56:26 PM »
Hi all,

after searching the forums I noticed that quite a few people got issues with running the unlimited sitemap generator on an IIS webserver.
Due to this, here are some things you should check if you're facing errors using generator on IIS (Error 500, no progress information during generation of the sitemaps).

1) Error 500 during sitemap generation
If the generation process of the sitemaps (especially for large websites) suddenly stops with an Error 500 and if you're using PHP in CGI/FastCGI mode, it is probably an issue of the FastCGI directive "RequestTimeout" which is set to 90 seconds by default. Increasing it to a higher amount will probably fix any Error 500 issue.

2) No progress information during generation of the sitemaps
If you're seeing no progress information except for "Please wait. Sitemap generation in progress..." the output of the script is probably buffered in some way. The default behavior of IIS is to buffer the output of any script and send it to the webserver only after the script has entirely finished running. You can check this behavior by uploading the attached script to your webhosting account (and removing the .txt from its filename). If the script output is "Flush failed. :-(", then you know that the ouput is buffered and so prevents the progress information to be displayed.

If this is case, you need to disable IIS's responseBufferLimit by setting it to 0.

You can do this the following way: if you can see any web.config file on your website root, find the tag starting with <handlers> and inside it there should be a child node similar to this one:

<add name="PHP Handler" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\PHP5\php-cgi.exe" resourceType="Either" requireAccess="Script" />

If so, simply modify it as follows, save the web.config file  and upload it to your website root again:

<add name="PHP Handler" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\PHP5\php-cgi.exe" resourceType="Either" requireAccess="Script" responseBufferLimit="0" />

If you're unable to perform the changes above, ask your webhost to do it for you.

If the changes were successful, try running the attached script again. If it outputs "Flush succeeded! :-)" than everything should be fine and progress information should now be displayed.
If the script still outputs "Flush failed. :-(", double check that the PHP output is not buffered by any third-party PHP extension or something similar. Also check that PHP "output_buffering" is Off, as well as "zlib.output_compression".

For more information on PHP output buffering, see this blog entry (I also got the script from this site): [ External links are visible to forum administrators only ]

I hope this post can help anyone setting up their standalone sitemap generator successfully on an IIS webserver.

Feedback is always appreciated  ;)

Cheers,
Eric