Well, I figured out what was going on: I had a misconfigured nginx server.
Marc B's answer, though related to Apache, prompted me to check out my PATH_INFO value — lo and behold, PATH_INFO was nonexistent, even for requests like GET /other.php/something_else
.
Some more searching turned up the answer. Using nginx's fastcgi_split_path_info
to split the URI into a) the path to the script and b) the path that appears following the script name will fail if done after a use of the try_files
directive, due to its rewriting the URI to point to a file on the disk. This obliterates any possibility of obtaining a PATH_INFO string.
As a solution, I did three things (some of these are probably redundant, but I did them all, just in case):
In a server's location block, make use of
fastcgi_split_path_info
before setting up PATH_INFO viafastcgi_param PATH_INFO $fastcgi_path_info;
...and do both before making use of
try_files
.Store
$fastcgi_path_info
as a local variable in case it ever changes later (e.g. withset $path_info $fastcgi_path_info;
)When using
try_files
, don't use$uri
... use$fastcgi_script_name
. (Pretty sure this was my biggest mistake.)
Sample Configuration
server {
# ... *snip* ...
location ~ \.php {
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
try_files $fastcgi_script_name =404;
}
# ... *snip* ...
}
Where fastcgi_params
contains:
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_param PATH_TRANSLATED $document_root$path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# ... *snip* ...
Reference
The following links explain the problem pretty well and provide an alternate nginx configuration: