Search code examples
perlapachecgicentosinternal-server-error

CGI script not running, Internal Server Error (500) Error


I am trying to run a cgi script, its a long script so i wont paste here but it works on my other servers but for some reason when I try to run it on my new server I get Internal server error (500), and when I check the apache log here is what I get :

[Fri Mar 30 08:38:29 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Fri Mar 30 08:38:29 2012] [error] [client 199.212.76.124] Premature end of script headers: test.cgi
[Fri Mar 30 08:38:29 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:11 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Fri Mar 30 08:41:11 2012] [error] [client 199.212.76.124] Premature end of script headers: test.cgi
[Fri Mar 30 08:41:11 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:12 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Fri Mar 30 08:41:12 2012] [error] [client 199.212.76.124] Premature end of script headers: test.cgi
[Fri Mar 30 08:41:12 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:15 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Fri Mar 30 08:41:15 2012] [error] [client 199.212.76.124] Premature end of script headers: test.cgi
[Fri Mar 30 08:41:15 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:20 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/upload.cgi' failed
[Fri Mar 30 08:41:20 2012] [error] [client 199.212.76.124] Premature end of script headers: upload.cgi
[Fri Mar 30 08:41:20 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:21 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/upload.cgi' failed
[Fri Mar 30 08:41:21 2012] [error] [client 199.212.76.124] Premature end of script headers: upload.cgi
[Fri Mar 30 08:41:21 2012] [error] [client 199.212.76.124] File does not exist: /var/www/htdocs/favicon.ico
[Fri Mar 30 08:41:29 2012] [error] [client 199.212.76.124] (2)No such file or directory: exec of '/var/www/cgi-bin/upload.cgi' failed, referer: http://bla.com
[Fri Mar 30 08:41:29 2012] [error] [client 199.212.76.124] Premature end of script headers: upload.cgi, referer: http://bla.com

I have tried everything, chmod the files, reinstall perl modules, rechecking the configuration etc!!!! Can not figure out what is wrong!!! but I can guarantee that the script is not broken!

Regards


Solution

  • Try running:

    perl -c /var/www/cgi-bin/upload.cgi
    

    Quote from perldoc perlrun:

       -c   causes Perl to check the syntax of the program and then exit
            without executing it.  Actually, it will execute "BEGIN",
            "UNITCHECK", "CHECK", and "use" blocks, because these are
            considered as occurring outside the execution of your program.
            "INIT" and "END" blocks, however, will be skipped.