Cgi htaccess question


I compiled a custom python in my account.

If I try to run the scripts (without a #!.. line) having:
AddHandler custompy .py
Action custompy /cgi-bin/python.cgi

in the .htaccess file, the server throws an “Internal Server Error”.
But if I use the shebang line in the script (#!/home/account/site/cgi-bin/python.cgi) and with an empty .htaccess file it works.

I’m trying to figure out, why the first method doesn’t work, as it does for php ?


I solved the problem.
The way I did it, python didn’t receive the name of the script to run (that is in the PATH_TRANSLATED environment variable). It seems that php can automatically extract the path from that variable and run the script, but not python.

So I wrote a small launcher script; htaccess points to this script.


AddHandler mypython .py
Action mypython /cgi-bin/runpython.cgi

and runpython.cgi contains:

/home/account/site/cgi-bin/python.cgi $PATH_TRANSLATED

That makes sense. There’s a lot in PHP that was built unqiue to other languages. I do know that even Perl will not be able to understand PATH_TRANSLATED and will require a similar type of wrapper.