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-Scripts Path and Permissions

Discussion in 'General Discussion' started by kruptof, Aug 19, 2006.

  1. kruptof

    kruptof Registered

    Joined:
    Aug 16, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    i wrote some cgi scripts in perl and when i upload these scripts they don't seem to work, i tried changing the permissions and the path but nothing works.........where am i meant to put my scripts by default and what permission should the scripts have? i know there is no problem with code because i have tried and tested it before uploading it? i thank you inadvance for your replies.
     
  2. randomuser

    randomuser Well-Known Member

    Joined:
    Jun 25, 2005
    Messages:
    147
    Likes Received:
    0
    Trophy Points:
    16
    When you say "it doesn't work", you'll need to clarify _exactly_ what happens when you try running the cgi script. What exactly do you see when you enter the URL into your browser?
     
  3. AnthonyCaesar

    AnthonyCaesar Active Member

    Joined:
    Feb 21, 2005
    Messages:
    32
    Likes Received:
    0
    Trophy Points:
    6
    This is a super simple cgi script that i installed and it does not work.

    #!/usr/bin/perl -w
    print <<EndOfHTML;
    Content-type: text/html
    <HTML>
    <HEAD>
    <TITLE> Hello World</TITLE>
    </HEAD>
    <BODY>
    <H1> Hello</H1>
    <P>This is a simple page</P>
    </BODY>
    </HTML>
    EndOfHTML


    And this is the error I got

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, webmaster@superstacks.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.


    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    I know nothing about perl or cgi just foolin with it a bit. What could be the problem
     
  4. krava

    krava Well-Known Member

    Joined:
    Sep 23, 2003
    Messages:
    149
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Yes, the script doesn't work, because it tries to create the HTML header too late. Please modify your script to:
    *******************
    #!/usr/bin/perl -w

    print "Content-type: text/html\n\n";
    print <<EndOfHTML;
    <HTML>
    <HEAD>
    <TITLE> Hello World</TITLE>
    </HEAD>
    <BODY>
    <H1> Hello</H1>
    <P>This is a simple page</P>
    </BODY>
    </HTML>
    EndOfHTML

    *******************
    and it will work. Also, make sure EOL exists after the last "EndOfHTML".

    Additionlly, don't forget to change the scripts access permissions to 755 and probably this page:
    http://www.cgi101.com/book/ch1/text.html
    will be useful for you too.
     
    #4 krava, Oct 13, 2006
    Last edited: Oct 13, 2006
Loading...

Share This Page