LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   CGI script 500 error (http://www.linuxquestions.org/questions/programming-9/cgi-script-500-error-453609/)

newuser455 06-11-2006 12:46 AM

CGI script 500 error
 
I am having the hardest time with certain CGI/Perl scripts on my server. Some will run, and some return a 500 error. Right now I need to get this script to work, but it returns a 500 error, while a script like this one works fine. I checked permissions on the one I cannot get working, and made sure it was uploaded in ASCII mode, yet it still refuses to work properly. Could someone look at the 2 scripts I have provided and see if maybe they can figure out what might be causing this problem? I am guessing it has to do with the server configuration, because I have had this script, along with others I have tried work on other servers. Thank you. I would greatly appreciate any help.

j-ray 06-11-2006 05:48 AM

what os and server is the script running on? on my box it works. may be a problem to give names of directories thru a form if working on a windoze - but just guessing...

newuser455 06-11-2006 09:44 AM

I am using CentOS 4.2 on this machine, with perl 5.8 I believe.

newuser455 06-11-2006 09:48 AM

I just had a thought. Apache is configured to use mod_perl to execute perl and CGI scripts. Could this have something to do with it?

j-ray 06-11-2006 11:01 AM

i wonder why u dont get a more precise error message as "fatalsToBrowser" are used. Take a closer look at apache error_log and post what u find here. (maybe in /var/log/apache2/error_log?)

newuser455 06-11-2006 01:45 PM

I checked there, here is what it says:

Quote:

[Sun Jun 11 12:44:30 2006] [error] [client [my ip]] (2)No such file or directory: exec of '/home/httpd/vhosts/[my vhost]/cgi-bin/setup.cgi' failed
[Sun Jun 11 12:44:30 2006] [error] [client [my ip]] Premature end of script headers: setup.cgi

xhi 06-11-2006 02:16 PM

did you verify the permissions of /home/httpd/vhosts/[my vhost]/cgi-bin? make sure the dir is allowing apache access.

j-ray 06-11-2006 02:35 PM

i dont have the time to go thru the script again but as far as i remember the user directory is sent by form. this directory probably doesnt extist or isnt writable for the apache user - i'm guessing...

newuser455 06-11-2006 02:56 PM

I finally got the script to work.

1) Installed CGI.pm.
2) Changed perl path to "/usr/bin/perl -w" (won't work without the -w)


All times are GMT -5. The time now is 03:55 AM.