(Q) PHP parse errors for XHTML

From: Date: Tue, 16 May 2000 18:58:17 +0000
Subject: (Q) PHP parse errors for XHTML
Groups: php.general 
Request: Send a blank email to php-general+get-111@lists.php.net to get a copy of this message
Friends, I apologize if this is a newbie question. I am running PHP 4.0 RC1 over Apache 1.3.12 (built as mod_php into Apache). PHP code embedded in HTML files is working. PHP code embedded in XHTML files is *not* working. XHTML files are basically composed of HTML grammar but with XML syntax. Upon trying to load the XHTML page, I get the following PHP error:
        Parse error: parse error in /<mypath>/test.php on line 1
Below is a sample XHTML file that generates that error. I tried using the '<?php' and the '<script language="php">' forms, but that didn't help. I believe that '<?xml' needs to be the first line in the XHTML file and there are no other alternatives on the XML side of the house. Is there a PHP or Apache configuration directive that I can use to get PHP to work with these files? Or? I guess one could argue that if you have PHP, why even use emerging XML-based standards? My preference would be to be that they, in general, should complement each other (grin). Thanks in advance, Wayne test.php --------------------------------------------------------------------------- <?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"> <head> <title>Test</title> </head> <body> This is the body <br> <? $mydate = date( "Y-m-d" ); PRINT "The date today is: $mydate"; ?> </body> </html> --------------------------------------------------------------------------- (end)

« previous php.general (#111) next »