#! does not seem to work in cgi-bin?? (script execution)
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
#! does not seem to work in cgi-bin?? (script execution)
I wrote some very simple perl and python scripts for testing in the cgi-bin/ of apache. I did chmod 755 on the script and all /var/www/ dirs are owned by user and grp root. I even invoked perl and python manually on the scripts by typing 'python testscript.py', etc. I cannot seem to invoke execution from ./testscript.py or the full pathname (which is the same either way). Thus, the #! won't work and when viewed from a web-browser I get "internal server error".
Please help. I am thinking it might have to do chroot or something not allowing the script to see after #!. Thanks.
(and yes, the #! matches with the correct path :P)
Originally posted by servnov I fixed the #! problem. It seemed to be some weird problem from writing it in notepad. I rewrote it in vi and it worked 100%.
But, I still get the "internal server error". I looked through http.conf and everything looked fine and I even experimented some. Any ideas?
So you have something like this for .cgi scripts and your py and pl scripts?
AddHandler cgi-script .cgi
For all of your types of scripts to be executed from the browser and server so apache knows what to do with such scripts? You even experimented some? Care to ellaborate on what you experimented with or did?
Why not link or post your httpd.conf file if your not sure?
Hey, thanks for help. The notepad problem was appending ^M to the end of each line. (vi didnt show this to me while editing it). Rewriting in a real text editor like vi solved it.
For cgi scripts do you need to manually redirect stdout? The cgi tests that came with apache in the cgi-bin/ are working fine. So its a script problem. Feel free to write an example py script or something...(maybe i need to import cgi..)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.