954,224 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Php parser error when xml version is mentioned

Hi

SureshM
Newbie Poster
2 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

I am giving this answer for future reference for somebody looking for the same answer.

The syntax is correct, but the following pages gave me the information I need:
http://www.php.net/manual/en/language.basic-syntax.php
http://www.php.net/manual/en/ini.sect.language-options.php#ini.short-open-tag

The answer is:
[1] Either disable short_open_tag in the php.ini. [But not always we have the option as webhosting company might not be willing to change.]
[2] The alternative is to use this
<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); ?>

SureshM
Newbie Poster
2 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

I am still looking for other solutions, but may do well to add this...

If the page is not being server-parsed I receive the same error.
So for instance, take a .htm file with the xml declaration,
when I add...
AddHandler server-parsed .htm
...the error goes away.

Cheers,
TwoHawks

twohawks
Newbie Poster
3 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You