View Single Post
  #1 (permalink)  
Old 08-06-08, 10:30 PM
greenpig greenpig is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
XML causes PHP parse error

Hi, I'm new to this site and relatively new to PHP, so my apologies if this has been answered before (a quick search of the forum didn't turn up anything).

I code my web pages in XHTML and they all start:

HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
I want to parse these pages for PHP, but when I do the first of these lines throws up an "unexpected T_STRING" parse error. A look at phpinfo() showed me that "short_open_tag=on" by default on my hosting service. So I created a custom php.ini file that sets short_open_tag=off, and now phpinfo() confirms that short tags are off. However I'm still getting the same parser error:

Parse error: syntax error, unexpected T_STRING in [URL] on line 1

I know it is possible to work around this problem by wrapping the offending line in a <?php echo ... ?> command, but this breaks the syntax checker in BBEdit, where I do my coding. Does anyone have any ideas what else might be causing the parser to choke on this line?

Thanks!
Reply With Quote