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 not working

Discussion in 'General Discussion' started by ctbhost, Aug 14, 2003.

  1. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    i am having a problem running cgi on my server

    i run the cgi file in a ssh and it works fine but in a web browser it gives a 500 Internal Server Error ??

    any idea's

    i have changed all permissions to 755 but still no go

    even setup a basic script to test it out and still the same

    HELP

    cPanel.net Support Ticket Number:
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Does the script have
    print "Content-type: text/html\n\n";
    somewhere near the start?

    Without it, it'll work in ssh but not http.

    cPanel.net Support Ticket Number:
     
  3. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    yep it does

    cPanel.net Support Ticket Number:
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I was hoping that would help. I know about that possibility because I have forgotten that line before. :eek:

    Do your error logs give any clue?

    cPanel.net Support Ticket Number:
     
  5. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    no the error logs dont say anything at all that i can see

    cPanel.net Support Ticket Number:
     
  6. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
  7. xion

    xion Active Member

    Joined:
    Apr 6, 2003
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    Is the path to perl correct? Did you make sure to upload it in ASCII mode?
     
  8. ctbhost

    ctbhost Well-Known Member

    Joined:
    May 31, 2002
    Messages:
    139
    Likes Received:
    0
    Trophy Points:
    16
    found the problem

    it was there wasnt a blank line after the first line in the script

    IE:
    #!/usr/bin/perl
    placed a blank line here and all is well


    sometimes it is the simplest things


    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  9. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Tell me about it. :eek: 90% of the time I have trouble with a script, I either forgot the content type line, or I missed a bracket or necessary character.

    Earlier I never thought to mention, how I always test my scripts for trouble is with the useful function:
    perl -c /path/to/script
    This almost always points out the problem.

    Also, if you add:
    use CGI::Carp qw(fatalsToBrowser);
    near the start, it shows the problems in your browser. I put that in most of my scripts and just comment it out when I'm done.

    cPanel.net Support Ticket Number:
     
  10. hicom

    hicom Well-Known Member

    Joined:
    May 23, 2003
    Messages:
    272
    Likes Received:
    0
    Trophy Points:
    16
    Here is the solution I found working if you have suExec ENABLED:

    1) The CGI folder and scripts must be chown username:username

    2) Script need to be chmod 711
     
Loading...

Share This Page