server gurus please help! - Premature End of Script Headers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hanii
    Confirmed User
    • Mar 2002
    • 449

    #1

    server gurus please help! - Premature End of Script Headers

    apache 2.0.46 (rhel es 3.0)

    I am trying to run a perl script on my server, but when I try to run it via a web browser I get "Internal Server Error." The server error log says "premature end of script headers." The permissions are 755 on the cgi-bin directory and the script. This is the script i'm trying to run:

    #!/usr/bin/perl -w

    print "Content-type: text/html\n\n";

    print "Hello, world.\n";


    This is the directive I have in my httpd.conf file:

    Directory "/home/users/*/www/cgi-bin">
    Options ExecCGI
    /Directory>
    (removed '<' for banned word)

    Anyone know what the problem could be?
    Last edited by hanii; 02-28-2004, 01:10 AM.
  • KDizzla
    Confirmed User
    • Sep 2002
    • 1795

    #2
    Could be a number of things...
    www.ogrish.com

    Comment

    • darksoul
      Confirmed User
      • Apr 2002
      • 4997

      #3
      watch error.log for the actual error.
      1337 5y54|)m1n: 157717888
      BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
      Cambooth

      Comment

      • hoe_vender
        Confirmed User
        • Dec 2003
        • 2018

        #4
        ICQ #286508534

        Comment

        • 420
          cuck
          • Mar 2003
          • 11571

          #5
          Originally posted by hoe_vender
          good job man, I knew with just a few more smilie posts you would pass 500 tonight

          <!--BEGIN SIMUTRONICS PLAY BUTTON CODE -->
          <p align="center">

          <a href="http://buddy.play.net/dr?TMOREAU1">

          <img src="drplay.gif" width="128" height="64" alt="Play DragonRealms!"></a></p>

          <!--END SIMUTRONICS PLAY BUTTON CODE -->

          Comment

          • devmug
            Registered User
            • Jan 2004
            • 3

            #6
            might be control-m on the end of lines .. this sometimes produces premature blah errors .. try editing your source in a proper editor such as textpad and saving as file type unix or use vi on your server ... hope this helps.

            Devmug
            avsMatrix
            Lex (devmug)
            [email protected] | aol devmug | icq 249438559
            http://www.sexcontents.com - Niche Adult Content

            Comment

            • Nathan
              Confirmed User
              • Jul 2003
              • 3108

              #7
              hi hanii

              I do not have access to any rhel es 3.0 box to test this, but the problem very likely is because the script is not really executable.

              Not sure if you have shell access, but if you have, then go and login to the server, go to the dir the script is at and run it manually.

              eg: if the script is called helloworld.cgi then type: ./helloworld.cgi

              See if that works. If that works, make sure the ending is .cgi and not .pl, since Options ExecCGI would only allow .cgi to execute as far as I remember.

              If it does NOT work (which is very likely) then your path to perl will be wrong. It will say something like:
              bash-2.0: /usr/bin/perl: No such file or directory

              Easiest way to figure this out is typing:
              whereis perl
              on the prompt. This should give you the real location of perl on the server. It might also be perl5, ie:
              whereis perl5

              The error might also be a perl error. I do not see a perl error in the code you posted, but it might be a wrong upload like devmug suggested, meaning you have to upload the file in ASCII mode!


              If you do NOT have shell access to the server, contact your host and ask them what the path to perl is, since that is the most likely error.
              "Think about it a little more and you'll agree with me, because you're smart and I'm right."
              - Charlie Munger

              Comment

              • rounders
                Confirmed User
                • Sep 2003
                • 2931

                #8
                check the suexec log
                ICQ#: 153923840

                Comment

                • RK
                  Confirmed User
                  • Aug 2001
                  • 868

                  #9
                  Are you using suexec?
                  The log is called suexec_log
                  Does anyone look down here?

                  Comment

                  Working...