我最近在朋友networking服务器上做了一些工作,但是我在执行PHP脚本时遇到了麻烦。 服务器是CentOS 5.8。 这是Apache日志在尝试执行脚本(test.php,权限0644)后的样子:
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] SoftException in Application.cpp:256: File "/serv/website/www/test.php" is writeable by group [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] Premature end of script headers: test.php [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/cp_errordocument.shtml [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] unable to include "cp_errordocument.shtml" in parsed file /serv/website/www/500.shtml [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/favicon.ico [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/cp_errordocument.shtml [Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] unable to include "cp_errordocument.shtml" in parsed file /serv/website/www/404.shtml
这是我访问脚本时得到的唯一信息: [an error occurred while processing this directive]
我一直在search这个问题几个小时,我仍然无法find解决scheme。 任何帮助表示赞赏! 我很不熟悉服务器pipe理,所以让我知道你是否需要更多的信息。
编辑:这是我的test.php
<?php echo phpinfo(); ?>
编辑2:当我将#!/usr/bin/php到我的PHP脚本的顶部时,我可以在shell中运行它,但是我仍然在浏览器中得到相同的结果。
没有更多的信息,这些是我可以给你的build议。
“脚本标题的提前结束”意味着脚本在发送标题之前出错。 所以testing这个问题的一个解决scheme是closures输出的缓冲。 如果这不起作用。 最明显的将是如果脚本有非unix新行,有时可能会混淆执行。
最简单的方法是从命令行运行脚本来查看它产生的错误。 testing时,您可能需要将权限更改为0755。
试试这个并更新我们。
编辑:
在Application.cpp中的SoftException:256:文件“/serv/website/www/test.php”是可写的,表示apache权限configuration错误。 检查path/服务器/网站/万维网的权限确保他们不是777.尝试755的目录。
//为什么selectoO?
错误消息说test.php是组可写的。 尝试从文件中删除g:w权限
chmod gw test.php