PHP 配置不正确

PHP 配置不正确

我刚刚在 ubuntu 服务器上安装了 php.5.1.2。

我尝试运行简单的测试:

<? phpinfo() ?>

它不仅显示了信息,还显示了 HTML 标签:

</table><br />
<h2>PHP License</h2>
<table border="0" cellpadding="3" width="600">
<tr class="v"><td>
<p>
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file:  LICENSE
</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
<p>If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact [email protected].
</p>
</td></tr>
</table><br />
</div></body></html>

我是从源代码编译的。我没有找到删除它的好方法。

有人能告诉我出了什么问题吗?

答案1

听起来默认的 MIME 类型是错误的。它被解释为 text/plain,而它应该被解释为 text/html。我没有从源代码编译。从我安装的软件包中,在三个文件 /etc/php5/apache2/php.ini、/etc/php5/cgi/php.ini 和 /etc/php5/cli/php.ini 中有一段内容如下:

PHP's built-in default is text/html
; http://php.net/default-mimetype
default_mimetype = "text/html"

相关内容