[nycphp-talk] Friendly URLs with php as CGI
Dell Sala
dell at sala.ca
Thu Jan 18 09:51:23 EST 2007
Hi all,
During a recent discussion we talked about a technique for supporting
friendly URLs by putting script arguments after the script name,
separated by slashes, instead of using a standard query string.
http://lists.nyphp.org/pipermail/talk/2006-December/020277.html
example: http://somedomain.com/phpscript/arg1/arg2
I've been using this technique for several months, with great
success, but I just ran into a snag. This doesn't seem to work when
php is running as a CGI. Here's what appears to be happening (using
the example above):
1) apache sees that "phpscript" is an actual php resource, and
ignores /arg1/arg2
2) apache passes the full url off the the php CGI
3) the php CGI re-parses the url, and determines the php script it is
supposed to execute is "arg2", and of course chokes with the error
"No input file specified."
I also found some reports of $_SERVER['PATH_INFO'] not reporting the
correct information when running as CGI.
Can anyone suggest a workaround? I hope I don't have to go back to
mod_rewrite!
-- Dell
More information about the talk
mailing list