PATH_INFO not (always) working in CGIs


When I try to bring up http://[myhost]/cgi-bin/printenv/foo/bar/baz I get a 403 Forbidden error. The Apache error log shows

(21)Is a directory: access to /cgi-bin/printenv/foo/bar/baz failed

Basically, instead of invoking printenv with a PATH_INFO of /foo/bar/baz, Apache is trying to interpret the path as a directory and of course finds nothing there.

But if I bring up /cgi-bin/printenv, something "wakes up" and remembers that printenv is a CGI. After that, invoking it with a path works -- for a while. Then it forgets, and I have to repeat the "wake up" procedure.

Of course I'm not interested in printenv. The problem is that I have a bunch of CGIs which depend on getting PATH_INFO. Help!


Make sure your CGI program has execute permissions. (do chmod +x <myscript.cgi>)

Not sure if this is the problem, but it could be...


There's no seperation of your url from your arg. You need a ? in there somewhere. Check the url you are at right now for syntax.

http myhost/cgi-bin/thingy?path=foo/bar/baz

Is this a solution to your problem?


Halim: I do have execute permission set, but thanks, that's the first thing to check.

theed: I wondered about that too. Turns out you can pass info to CGIs either through a query (as you describe) or as extra path information, or both at the same time. Do a search on PATH_INFO to learn more.

All: I guess what I'd like from the Mac OS X community is for folks to try this on their own machines to see if this is specific to my set-up or a more general problem. Thanks in advance.