Apache/PHP AddHandler 包装器上出现 500 内部服务器错误
我正在尝试创建一个包装器/处理程序,每当有人请求目录内的任何 PHP 脚本时,Apache 服务器都会调用该包装器/处理程序。这样我就可以为整个目录授权用户,或者编写一些其他内容,以便在调用目录时调用。
这是我能想到的最好的配置......
<Directory "/srv/http/INNOV/PUBLIC_HTML/kb">
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php
AddHandler auth_handler .php
Action auth_handler /kb/auth_handler.php
</Directory>
[2010 年 12 月 1 日星期三 12:28:06] [错误] [客户端 xxx.xxx.xxx.xxx] 请求 超过 10 个内部的限制 由于可能的原因重定向 配置错误。使用 'LimitInternalRecursion' 增加 必要时限制。使用“日志级别” debug' 来获取回溯。
注意:我在 LogLevel 调试中没有看到任何内容。
这是我的处理程序(到目前为止)...现在只是尝试执行“echo”或“die”...
<?php
$FILE = $_SERVER['PATH_TRANSLATED'];
//readfile($FILE);
die($FILE);
?>
另外,请请注意,这是在虚拟主机指令内,但这并不重要。我还尝试了“Action”指令的第三个参数“virtual”选项和同样的事情。
有谁知道为什么会这样做?
I'm trying to create a wrapper/handler that will be called on the Apache server whenever someone requests any PHP script inside of a directory. That way I can authorize users for the entire directory or write some other stuff to be called when the directory is called.
This is the best configuration I've been able to come up with...
<Directory "/srv/http/INNOV/PUBLIC_HTML/kb">
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php
AddHandler auth_handler .php
Action auth_handler /kb/auth_handler.php
</Directory>
[Wed Dec 01 12:28:06 2010] [error]
[client xxx.xxx.xxx.xxx] Request
exceeded the limit of 10 internal
redirects due to probable
configuration error. Use
'LimitInternalRecursion' to increase
the limit if necessary. Use 'LogLevel
debug' to get a backtrace.
Note: I didn't see anything in LogLevel debug.
This is my handler (so far)... just trying to do an 'echo' or 'die' for now...
<?php
$FILE = $_SERVER['PATH_TRANSLATED'];
//readfile($FILE);
die($FILE);
?>
Also, please note, this is inside a virtualhost directive, but that shouldn't matter. I also tried the 3rd parameter "virtual" option for the "Action" directive and same thing.
Does anybody know why it would do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
猜测 - 因为 auth_handler 脚本 auth_handler.php 位于您尝试处理的文件夹内,所以您将陷入无限循环。也就是说,它接收 php 请求,将其定向到 auth_hanlder,后者尝试调用 auth_handler.php,然后再次加载处理程序,等等。将 auth_hanlder.php 从该文件夹中移出,看看是否可以解决问题。
At a guess - because the auth_handler script auth_handler.php lives inside the folder you're trying to handle, you're getting an infinite loop. That is, it recieves the php request, directs it to auth_hanlder which attempts to call auth_handler.php which then loads up the handler again, etc. Move auth_hanlder.php out of that folder and see if that fixes the issue.