The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CGI access

Discussion in 'General Discussion' started by spiritguardian, May 6, 2004.

  1. spiritguardian

    spiritguardian Active Member

    Joined:
    Apr 30, 2004
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Problem: can't seem to get cgi running. I basically have one account that I add all my domains onto, which I refer to below as PrimaryUser. I am the root user, fwiw.

    OS: RHEL 3

    I have created an addon domain and wish to run cgi scripts there, but I'm running into a dead end. Here's my basic test script:

    File: index.cgi
    ################
    #!/usr/bin/perl

    print "hi.\n\r\n";

    exit;

    -----------------------------------------------

    I run this file from the command line and I get "hi." in text.

    It's located here:

    /home/PrimaryUser/public_html/basseyworld/cgi-bin/

    Which can be found at http://www.basseyworld.com/cgi-bin/index.cgi

    The error in the log looks like this:

    Premature end of script headers: /home/PrimaryUser/public_html/basseyworld/cgi-bin/index.cgi

    Here's the http.conf entry for the addon domain user, basseyworld.

    ScriptAlias /cgi-bin/ /home/PrimaryUser/public_html/basseyworld/cgi-bin/




    What have I gotten wrong?
     
  2. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    your forgetting to include the print ("Content-type: text/html\n\n") which is called before anything is printed out to the browser.. the content header so it can be displayed in the web browser, this isn't required when called through the command line.

    But best to use the CGI module, so all you need to do is do print header(); .... alot easier. The CGI.pm module is a perl programmers best friend IMHO! :D

    Mickalo
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I hate it :p ;)

    spiritguardian, I've given you a suggestion on your cross-post with the ServerMatrix forums where the thread has advanced beyond this one.
     
  4. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    It was just a suggestion.

    Mickalo
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    It wasn't a criticism :)

    You were quite right in that he needed the content-type string, but his problems are greater than that, apparently.
     
  6. spiritguardian

    spiritguardian Active Member

    Joined:
    Apr 30, 2004
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Ok, got it. Thanks all!
     
Loading...

Share This Page