500 Internal Server Error on Apache/PHP AddHandler wrapper
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...
<Dire开发者_如何学编程ctory "/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?
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.
精彩评论