html page returns server error on php server

When I open a simple HTML page on Apache, using usbwebserver 7.0 (www.usbwebserver.com)  I get a server error.
One problem seems to be the <?xml version="1.0"encoding="UTF-8"?> line. If I type only the php tag within the simple <html> and <body>  tags there's no server error, as soon as I add the <?xml> tag I get a server error.
Is there a settng I can change in one of the server setting files to make this work?
Setting files are enclosed.


<?xml version="1.0"encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>	... </title>
	</head>
	<body>
		<p>
			<?php
			print("hallo PHP wereld!"); 
			?>
		</p>
	</body>
</html>

Open in new window

settings.ini
settings.txt
settings.ini
php.ini
ruud00000Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
<?xml version="1.0"encoding="UTF-8"?> is used for serving up XML documents.  XHTML pages do not use that.  Acceptable DOCTYPES for 'text/html' are listed here:
http://www.w3.org/QA/2002/04/valid-dtd-list.html
0
tv0085Commented:
There is a setting in php.ini.
change
short_open_tag = On
to
short_open_tag = Off

; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
0
ruud00000Author Commented:
I tried that, no change.
0
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Dave BaldwinFixer of ProblemsCommented:
This works fine.  Displays 'hallo PHP wereld!' twice.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>	... </title>
	</head>
	<body>
		<p>
			<?php
			echo("hallo PHP wereld!"); 
			print("hallo PHP wereld!"); 
			?>
		</p>
	</body>
</html>

Open in new window

0
Dave BaldwinFixer of ProblemsCommented:
By the way, this has to be saved as 'myfile.php' with the php extension for it to be processed thru the PHP interpreter.  It won't work as 'myfile.html'.
0
ruud00000Author Commented:
Hello Dave,

The code you provided works fine, since the
<?xml version="1.0"encoding="UTF-8"?>  
line is not included.
However when this is included (see question) the problem arises, also (NOT to be expected) when short_open_tag is set to 'Off' in php.ini.

If I understand your answer well you say I shouldn't want to use xml commands in a XHTML document when using PHP, but the whole idea of using the <?php instead of the short tag <? is that is should work well also in combination with xml commands? Correct me if I'm wrong.
0
Dave BaldwinFixer of ProblemsCommented:
XHTML is not XML, it is only kind of related.  XHTML uses HTML tags in a particular way.  It requires them to be "well formed" with both open and close tags.  See this page for more detail: http://en.wikipedia.org/wiki/XHTML.  If you are designing web pages, see this page for the acceptable DOCTYPES: http://www.w3.org/QA/2002/04/valid-dtd-list.html

The long tag versus short tag (<?php versus <?) is a setting in the php.ini on your server.  If you  put the code below on your server as a file called phpinfo.php and access it thru your web browser, it will tell you all of the PHP settings and modules in use on your server.
<?php
phpinfo();
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ruud00000Author Commented:
don't feel my question was answered
0
Dave BaldwinFixer of ProblemsCommented:
I'm sorry you don't feel your question was answered.  There are a lot of details about both XML and XHTML and PHP on http://www.w3schools.com/ .  I refer to them a lot because they list almost ever command and format available for a lot of web technologies.  

XML and XHTML are not interchangeable and you can't use the headers or DOCTYPEs interchangeably either.  Yes, you should use long tags <?php with XML because the XML header tag <?xml  contains a short tag and your php could confuse the two if you didn't.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.