我有這個問題,我的.php文件在瀏覽器中顯示爲明文。即,頁面不會以任何方式轉碼。我的HTML/php頁面在瀏覽器中顯示爲明文
這是我的HTML-FIL與形式
<html>
<head>
</head>
<body>
<form id="myForm" action="commentNoJQ.php" method="post">
Name: <input type="text" name="name" />
Comment: <textarea name="comment"></textarea>
<input type="submit" value="Submit Comment" />
</form>
<p>Click on the button to load result.html file:</p>
<div id="stage" style="background-color:blue;">
STAGE
</div>
<input type="button" id="driver" value="Load Data" />
</body>
</html>
這是一個形式張貼到我的PHP文件。該文件在瀏覽器中顯示爲:
<html>
<head>
</head>
<body>
<?php
$myFile = "/Library/WebServer/testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $_POST["name"]);
fclose($fh);
?>
</body>
</html>
問題是什麼?
這是php相關的正弦,當我創建一個正常的html文件發佈,正常的文件被處理,因爲它應該是。
這是它的外觀在瀏覽器中:
我查了日誌(訪問日誌,error_log中),沒有資料可言。還有其他日誌我應該檢查嗎?
使用Apache 2.2和Mac OSX 10.6.4
在此先感謝!
/Niklas
檢查你的Apache它包括處理程序PHP? – ajreal 2010-11-19 11:16:09
謝謝,這是問題所在。我發現如何在這裏做到這一點:http://foundationphp.com/tutorials/php_leopard.php – Nicsoft 2010-11-19 12:39:11