I just upgraded to the latest 6.x-dev and got this error in multiple pages.

Fatal error: Class 'XMLWriter' not found in .../sites/all/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 12

Comments

antiorario’s picture

Here's what I get—it sounds related:

warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 37.
user notice: Could not open file sites/default/files/xmlsitemap/XsvGqDExEw3nzxzru4YYRD4YSY0mlhQ6tHCf1UuIzE0/1.xml for writing. in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 39.
warning: XMLWriter::setIndent() [xmlwriter.setindent]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 45.
warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 46.
warning: XMLWriter::writePi() [xmlwriter.writepi]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 57.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 58.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeAttribute() [xmlwriter.writeattribute]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 82.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 84.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 125.
warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 122.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 98.
warning: XMLWriter::endDocument() [xmlwriter.enddocument]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 151.
warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 37.
user notice: Could not open file sites/default/files/xmlsitemap/XsvGqDExEw3nzxzru4YYRD4YSY0mlhQ6tHCf1UuIzE0/2.xml for writing. in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 39.
warning: XMLWriter::setIndent() [xmlwriter.setindent]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 45.
warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 46.
warning: XMLWriter::writePi() [xmlwriter.writepi]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 57.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 58.
warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 78.
warning: XMLWriter::writeAttribute() [xmlwriter.writeattribute]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 82.
warning: XMLWriter::writeRaw() [xmlwriter.writeraw]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 84.
warning: XMLWriter::endDocument() [xmlwriter.enddocument]: Invalid or unitialized XMLWriter object in /<path>/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 151.

Also, sitemap files return a 404. That happens only in one installation. Two more installations seem to have no problems.

dave reid’s picture

Priority: Critical » Major
Status: Active » Postponed (maintainer needs more info)

@EnekoAlonso: What version of PHP are you using? The XMLWriter class should be provided by default in PHP 5.1+ so if you're missing that it's a big problem.

@antiorario: Your issue is not related as the XMLWriter class can be found. Does this installation happen to be on Windows? Also double check that your sites's sites/default/files/xmlsitemap directory is writeable by your webserver (going to admin/reports/status should be able to tell if you if is or not).

antiorario’s picture

It's a regular LAMP installation. The xmlsitemap directory is writable, and in fact the module does create the correct subfolders, but it seems unable to create the proper XML files inside them. What is weird is that I have pretty much the same setup on two installations, one of which works properly and the other doesn't. For the time being, I've moved back to the beta, so all is working properly.

wxman’s picture

Just adding that I had this same problem after the Oct 07 update. I had to go back to the previous version that I had saved. Now it's working fine.

Anonymous’s picture

Priority: Major » Critical
Status: Postponed (maintainer needs more info) » Active

I'm not sure whether this is related or not but I've been seeing the same error on an Ubercart site with 6.x-2.0-beta1. Then discovered that the Default Base URL in /admin/settings/xmlsitemap/settings had been set to "https" rather than "http". When I changed it, the error disappeared.

andrewfn’s picture

This error is quite common on CentOS / RHEL systems because php-xml is not compiled by default. However it is very easy to add it in as a module:

# If you are using the base 5.1.6 php, then
yum -y install php-xml

#if you are using php 5.2 (from the centos 5 testing repo)
yum -y --enablerepo=c5-testing install php-xml

#restart apache
service httpd restart
nasirbest’s picture

@andrewfn

Thanks! that was the problem, now it working

dave reid’s picture

Status: Active » Fixed

We've added a requirements check that checks to make sure the XMLWriter class is available now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

promes’s picture

For a site with several domains (domain acces module is active) I need the domain-xmlsitemap which needs the 2.0 version.
Today I installed the current offial version 6.x-2.0-beta2 and still have the same errormessage. Also I tried it with the current 6-dev version.
I use PHP version 5.1.6 with the following XML extensions enabled / active:
- DOM/XML
- libxml
- SimpleXML
- xml (XML support, XML namespace support).
The site runs on a external shared server (Apache), so I am not able to install the extras from #6 myself.
I php-xml some additional module the hosting company should install? If so, a lot of future users will have problems using this version since several hosting providers are not willing to install specific software.
I thank you for a module I use in all my Drupal sites. I will be pleased with your advice.

promes’s picture

Status: Closed (fixed) » Active

Resetting status

Anonymous’s picture

Status: Active » Closed (fixed)

Me too. See admin/reports/status for more information about the requirements for this module and PHP. This is a user environment issue.

promes’s picture

The problem is: when I enable the sitemapmodule and go to admin/reports/status I only get this warning: Fatal error: Class 'XMLWriter' not found in /var/www/html/sites/all/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 12.
So please state all the requirements on a readeble place. These are not in the readme nor on the project page. The only requirement found above: php-xml.
That's the reason I asked for advice and did give a warning not everybody is able to install additional php-modules.

vewakayeh’s picture

i am confused..

First I install the 6.x-2.x-dev in a server without php-xml installed and work without errors (is that normal?)

Second I install the customerror module the i got white screen and apache logs says PHP Fatal error: Class 'XMLWriter' not found in /home/emporoip/public_html/sites/all/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 11, referer: http://192.168.1.65/admin/settings/xmlsitemap/settings.

But when i tried the same steps to another identical setup both modules work without the XMLWriter error.

So... is it safe to use this module to a shared hosting server without php-xml installed or not???

also i agree with promes (#13) that this requirements it would be very useful to be on a readable place because not everybody is able to install additional php-modules.

dave reid’s picture

@vewakayeh: If you're using 6.x-2.0-beta2 you should see if there is a problem with the requirements at the place you should always be checking: admin/reports/status.

dalegrebey’s picture

Making sure that the xmlsitemap folder was writeable is what resolved this issue for me.

fgm’s picture

Issue summary: View changes

Just got this on the last D6 version during a D5 (!) upgrade: this happened because PHP 5.6 had a dummy xmlwriter config. sudo apt-get install php5.6-xml fixed it for me.

satinder’s picture

I recently got the same issue with an old Druoal 6 installation, and solution provided by @fgm helps me to fix the problem.
Thanks

fgm’s picture

Maybe we should add this to the module README ?