Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: CGI script gives "internal server error"

by japhy (Canon)
on Mar 03, 2009 at 19:30 UTC ( #747861=note: print w/ replies, xml ) Need Help??


in reply to CGI script gives "internal server error"

CGI notwithstanding, the error is in your here-doc syntax. In Perl, here-docs must be created in the following ways:

print <<NO_SPACE_BETWEEN_THE_ANGLE_BRACKETS_AND_THIS_TEXT; ... NO_SPACE_BETWEEN_THE_ANGLE_BRACKETS_AND_THIS_TEXT # or print << "SPACE_ALLOWED_WHEN_THIS_TEXT_IS_QUOTED"; ... SPACE_ALLOWED_WHEN_THIS_TEXT_IS_QUOTED
This is documented in perlop: "There must be no space between the '<<' and the identifier, unless the identifier is quoted. (If you put a space it will be treated as a null identifier, which is valid, and matches the first empty line.)"

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
Nos autem praedicamus Christum crucifixum (1 Cor. 1:23) - The Cross Reference (My Blog)


Comment on Re: CGI script gives "internal server error"
Download Code
Re^2: CGI script gives "internal server error"
by manish.rathi (Acolyte) on Mar 03, 2009 at 20:16 UTC
    I removed space between <<END_OF_HTML, but still script did not run successfully.

    I checked the error.log and there I saw following entries

    "Tue Mar 03 15:10:42 2009 error client 127.0.0.1 (OS 5)Access is denied. : couldn't create child process: 720005: server_info.cgi

    Tue Mar 03 15:10:42 2009 error client 127.0.0.1 (OS 5)Access is denied. : couldn't spawn child process: C:/Program Files/Apache Group/Apache2/cgi-bin/server_info.cgi"

    What does these error messages suggest ?

      Maybe your server doesn't know to use perl to execute .cgi files? First make sure your script is executable(if on unix). Also try adding one of the following shebang lines as the very first line in your script.

      UNIX:
      #!/usr/bin/perl
      WINDOWS either:
      #!perl
      or
      #!C:\perl\bin\perl.exe

      You should substitute the path with the correct path to your perl executable

      UPDATE: Doh, obviously those are windows paths. Ignore what I said about UNIX and try "#!perl" on the first line. Also verify the file has the correct permissions, that it's readable by the webserver

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://747861]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-08-01 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (52 votes), past polls