我配置的是PHP+Apache+mysql。访问数据库,测试html网页,测试php文件都正常(但没有测试过html中嵌入php代码的情况)。
后来,我发现浏览器不支持读取html中嵌入的PHP代码,比如对于下面这段代码,
-----------------------------------------------
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 </head> <body>
  this is html.hello world!
  <?php echo "this is php.Hello, World!"; 
  ?>
 </body>
</html>
-----------------------------------------------
就无法显示
this is php.Hello, World!搜索了一下解决办法,尝试在apache配置文件httpd.conf文件中添加了一句:
AddType application/x-httpd-php .html。
这样,可以显示了:
this is html,hello world! this is php, Hello, World!但是产生了一新问题,原来放在www下的另一个应用,这时候无法打开了:
“很抱歉,您访问的页面已不存在。”之前,这个应用是可以正常访问的。为什么修改了httpd.conf文件后,就导致另一个应用找不到入口了?望大家多多指点!谢谢

解决方案 »

  1.   

    这样是不对的,除非你想所有的html文件都按照php解释执行
    你应该修改为AddType application/x-httpd-php .php然后将所有带php代码的文件都重命名为php后缀名就可以正常执行了。
      

  2.   

    AddType application/x-httpd-php .php .php3