I am just doing an excersise in php. I`ve started my lamp server, created the html file and send it to /opt/lampp/htdocs ( saw that in phpinfo() ). Here is the tip.html content:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> TIP OF THE DAY</title>
</head>
<!-- start the body -->
<body>
<h1>Tip of the day</h1>
<?php
print "<h3> Here is your tip:</h3>";
?>
<div style="border-color:green; border-style: groove; border-width: 2px;">
<?php
readFile("tips.txt");
?>
</div>
</body>
</html>
When I open localhost/tip.html it gaves me a partial output... Here is your tip:"; ?> kind of partially parsing the output from the php script tag??? Any info why is that?
Try viewing source. You'll see the entire content of the file is being served, without the
<?php ?>
tags being evaluated. If you want PHP to handle serving a file, you need to either name the file with a.php
extension (tip.php, in this case), or configure your web server to handle.html
files through PHP.