S Murder Posted April 30, 2007 Share Posted April 30, 2007 When I include a file that holds the xml declaration and doctype, PHP parses the <? and ?> in "<?xml version="1.0" encoding="utf-8"?>". Is there a way to keep PHP from parsing it as code and giving me an error? Link to comment Share on other sites More sharing options...
boen_robot Posted April 30, 2007 Share Posted April 30, 2007 There are a number of ways of doing that. One I would suggest is to simply disable the shorthand(<? ?>), so that PHP only parses <?php ?>. You can do that by insering: <?php ini_set('short_open_tag',0); ?> Right before the XML prolog. Link to comment Share on other sites More sharing options...
S Murder Posted April 30, 2007 Author Share Posted April 30, 2007 There are a number of ways of doing that. One I would suggest is to simply disable the shorthand(<? ?>), so that PHP only parses <?php ?>. You can do that by insering:<?php ini_set('short_open_tag',0); ?> Right before the XML prolog. If I disable it right in php.ini, I'll have to reset my server, right? I have hosting from GoDaddy. Should I ask them to reset it? Link to comment Share on other sites More sharing options...
boen_robot Posted April 30, 2007 Share Posted April 30, 2007 If I disable it right in php.ini, I'll have to reset my server, right? I have hosting from GoDaddy. Should I ask them to reset it?You're most probably on a shared server. If they reset it for you, they'll reset it for everybody, and they won't do that. You'll have to disable it yourself with the above method. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 2, 2007 Share Posted May 2, 2007 Don't disable anything, don't screw with the configuration. If you do, then everywhere you move your application you'll have to explain to the server admin why they have to do the work because you didn't want to take the time to do it right.In this case, the answer is pretty easy. <?phpecho "<" . "?xml version=\"1.0\" encoding=\"utf-8\"?" . ">";?> PHP will not parse the XML tag as PHP. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.