Troubleshooting - Magento 1: XML declaration allowed only at the start of the document Print

  • 1

This issue can often be seen in the var/log/system.log when an xml document has some issues.

2018-03-17T02:50:01+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 2: parser error : XML declaration allowed only at the start of the document  in /var/www/vhosts/example.com/httpdocs/lib/Varien/Simplexml/Config.php on line 510
2018-03-17T02:50:01+00:00 ERR (3): Warning: simplexml_load_string():   in /var/www/vhosts/example.com/httpdocs/lib/Varien/Simplexml/Config.php on line 510
2018-03-17T02:50:01+00:00 ERR (3): Warning: simplexml_load_string():      ^  in /var/www/vhosts/example.com/httpdocs/lib/Varien/Simplexml/Config.php on line 510


You will need to find the cause of the problem and rectify. It is often caused by xml files that are invalid, or information that is missing in the xml files. You could use a process of elimination and disable each extension individually, or use an xml validation tool to validate your extension (or layout) files. Via SSH, run the following from within your Magento installation:

xmllint --noout app/etc/modules/*.xml


or

 

xmllint --noout app/design/frontend/yourpackage/yourtheme/*.xml

 

This will identify any invalid files and indicate where the issue lies:

 

[user@magevps httpdocs]# xmllint --noout app/etc/modules/*.xml
app/etc/modules/Example_Extension.xml:2: parser error : XML declaration allowed only at the start of the document
<!--?xml version="1.0"?-->
     ^



If you are a Create Hosting customer on the Magento Hosting Plan, feel free to submit a support ticket and we may be able to assist you with this.


Was this answer helpful?

« Back