Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I installed xmlsitemap on my local test site, running on Windows Vista, PHP 5.3.1. When building the sitemap files, I repeatedly got the following errors.
warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 37.
user notice: Could not open file sites/default/files/xmlsitemap/NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM/1.xml for writing. in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 39.
warning: XMLWriter::setIndent() [xmlwriter.setindent]: Invalid or unitialized XMLWriter object in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 45.
warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in C:\<snip>\sites\all\modules\contributed\xmlsitemap\xmlsitemap.xmlsitemap.inc on line 46.
...
This seems more like a deficiency in PHP's XMLWriter
than with this module ... it apparently can't handle non-canonical pathnames on Windows. I was able to get it working by adding the following 2 lines at the beginning of the openUri
function in the XMLSitemapWriter
class.
touch($uri);
$uri = realpath($uri);
I tried it on the live site (running on Linux) without the above fix, and it worked fine.
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedWhat does admin/reports/status report?
See #1058616-6: Fatal error after upgrading to beta2 from beta 1 and running update.php
Comment #2
killua99 CreditAttribution: killua99 commentedThat happen to me, I added those lines and it works!. Thanks.
Comment #3
tomsm CreditAttribution: tomsm commentedWorks for me too.
Comment #4
dave_______1 CreditAttribution: dave_______1 commentedThanks, worked for me too :)
Comment #5
jianxun CreditAttribution: jianxun commentedThanks, worked for me too :)
Comment #6
soloboom CreditAttribution: soloboom commentedJust need to add one row: touch($uri);