Sitemap plugin: mkdir() error on Windows IIS and fix


I have installed WPMU and Windows IIS, I usually don’t like saying this too loud because I get all the purist Linux folks booing. But then again, I might not be alone using a Windows plateform, so I thought I’d post this in case it helps someone out there.

The "Sitemap and SEO" plugin produced the PHP warning "PHP Warning: mkdir() [function.mkdir]: Invalid argument … in simple-sitemaps.php on line 101".

I have changed slightly the syntax for the function writefile() in simple-sitemaps.php to the following:

function writefile( $filename, $content ) {

$parts = explode( ‘/’, $filename );

$file = array_pop( $parts );

$filename = ”;

foreach ( $parts as $part ) {


if ( !is_dir( $filename.=$part.’/’ ) ) mkdir($filename);


file_put_contents( "$filename/$file", $content );



This fixes the problem (for IIS7 and PHP5).