douchun3680 2010-11-19 11:14
浏览 162
已采纳

我的HTML / php页面在浏览器中显示为明文

I have this problem that my .php file is presented as clear text in the browser. I.e., the page is not transcoded in any way.

This is my html-fil with a form

<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>

This is my .php file that the form is posting to. This file is presented as it is in the browser:

<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>

What is the problem?

It's php-related sine when I create a normal html-file to post to, the normal file is processed as it should be.

This is how it looks in the browser:

alt text

I checked the logs (access_log, error_log), no info at all. Are there any other logs I should check?

Using Apache 2.2 and Mac OSX 10.6.4

Thanks in advance!

/Niklas

  • 写回答

1条回答 默认 最新

  • doyp9057 2010-11-19 11:16
    关注

    PHP is not properly configured on Apache I think.

    UPDATE: links http://php.net/manual/en/configuration.changes.php http://www.php.net/manual/en/install.macosx.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 如果update 一个列名为参数的value
  • ¥15 基于51单片机的水位检测系统设计中LCD1602一直不显示
  • ¥15 OCS2安装出现问题,请大家给点意见
  • ¥15 ros小车启动launch文件报错
  • ¥15 vs2015到期想登陆但是登陆不上
  • ¥15 IPQ5018制作烧录固件,boot运行失败(操作系统-linux)(相关搜索:操作系统)(相关搜索:操作系统)
  • ¥20 icefall在librispeech基础上加入个人数据集
  • ¥30 keepalive高可用故障运维配置询问
  • ¥15 求帮助!国家电网内网u盘突然识别不出来了。
  • ¥15 matlab语音变速变调同时实现