I got this problem in XAMPP 1.8 where php is not show correctly in browser. Apparently, there are couple of people who had this problem as I read other posts. As I did some test myself, I found out that it only happened in the new XAMPP 1.8, thought I am not sure whether it's the PHP 5.4 problem or XAMPP itself.
Here is the script that i tested it with, index.php and LIB.php.
index.php ========================================
- Code: Select all
<?php
require_once 'LIB.php';
$string = html_header($title="Home",$style = "styles_sheet.css");
$string .= "<h1>HELLO</h1>";
$string .= html_footer();
echo $string;
?>
LIB.php ========================
- Code: Select all
<?
function html_header($title="Untitled",$styles = "styles_sheet.css"){
$string =<<<HEAD
<!DOCTYPE html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content="text/html;charset=utf-8" />
<title>$title</title>
<link type = "text/css" rel= "stylesheet" href = "$styles" />
</head>
<body>
HEAD;
return $string;
}
function html_footer(){
$string =<<<FOOT
</body>
</html>
FOOT;
return $string;
}
?>
==================================================
In XAMPP 1.7.7, it works fine... which's it shows "Hello" in h1 tag.
in XAMPP 1.8.0, here is the result...
When you run even simpler code such as <?php echo "hello"; ?> it work fine, phpInfo() work fine too..
note: I tried reinstalling, didn't work either. I view the file through server localhost, and not directly on computer. I did install the microsoft c++ 2008 32bit.
Any help would be appreciated, Thanks in Advance...
[EDIT by Altrea: added code-BBTags around code. Please next time add them on your own.]