10.6 服务器- PHP 不工作

10.6 服务器- PHP 不工作

尝试在 10.6.6 服务器中启用 PHP,它继续加载 php 文本(我可以在我的 .php 文件上看到 php 代码)。

我已经在服务器管理中启用了 php5 模块(并验证它在 httpd.conf 中)..我还可以尝试其他什么吗?

替代文本

我还删除了当前的 httpd.conf 并重新启动,但没有成功......

答案1

您还需要确保执行 php 代码的配置已到位

AddHandler php5-script .php
AddType text/html .php

答案2

事实证明我使用了 php 短标签并且没有在 php.ini 中打开它:

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On

答案3

不要忘记清理浏览器缓存或尝试使用其他浏览器。

相关内容