doulue7522 2013-06-18 16:04
浏览 115

Apache没有执行PHP脚本[关闭]

I changed the httpd.conf as follows:

  • Replaced

    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
    

    with

    DocumentRoot "C:/Temp/WebServerCore/Binaries/html"
    
  • Replaced

    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
    

    with

    <Directory "C:/Temp/WebServerCore/Binaries/html">
    

However Apache does not recognize the php code in my .html file. What other changes do I need to make for Apache to execute PHP?

  • 写回答

1条回答 默认 最新

  • dongzhi7763 2013-06-18 16:06
    关注

    It is by design. Apache will not parse PHP code inside a HTML file by default. You can include HTML codes in a PHP file as you would code them in a HTML document.

    Renames your files and add extension .php at the end they will parsed as you want.

    Or you can configure your apache configuration (httpd.conf) to parse PHP code inside HTML too.

    AddHandler application/x-httpd-php5 .html .htm
    

    Or you can match extension and set their handlers like

    <FilesMatch "\.(htm|html|php)$">
         SetHandler application/x-httpd-php
    </FilesMatch>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器