(Q) PHP parse errors for XHTML

[email protected] (Wayne Smith)
Newsgroups php.general
Message-ID <4.2.2.20000516113145.0213d260@mail1>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.