Results 1 to 7 of 7
  1. #1

    CGI / Perl not working ?

    Hey guys, iv had my server for a little while now, and im still a n00b lol, but its mainly only used for my own site.

    I came to learning CGI the other day as I already know a little PHP, and when trying to run my first basic script i got errors. Iv reearched it and a site says that its not a very descriptive error so anything could be wrong, the error I keep getting is a 500 internal server error.

    The script I was trying to run is basic:

    PHP Code:
    #!/usr/bin/perl -wT
    print "Content-type: text/html\n\n";
    print 
    "Hello, world!\n"
    I read somewhere that it could be that perl is not in the location described above, so i went into SSH and done this:

    Code:
    root@server [~]# which perl
    /usr/local/bin/perl
    So i changed the location of the perl path and tried this script:

    PHP Code:
    #!/usr/local/bin/perl -wT
    print "Content-type: text/html\n\n";
    print 
    "Hello, world!\n"
    still getting a 500 error. Is there some sort of setting I need to change to get perl working? Im useing linux / cpanel, and when i created the account the box for "has cgi" was ticked if tht helps.

    thanks for your time.

  2. #2
    Join Date
    Apr 2001
    Location
    Paradise
    Posts
    12,052
    Do you chmod your files to 755? what's the folder permission?
    Do you know if your host does require to have your Perl/CGI files on any special folder such as cgi-bin/ or anything similar?
    Shared Web Hosting - Reseller Hosting - Semi-Dedicated Servers - SolusVM/XEN VPS
    LiteSpeed Powered - R1Soft Continuous Data Protection - 24/7 Chat/Email/Helpdesk Support
    Cpanel/WHM - Softaculous - R1soft Backup - Litespeed - Cloudlinux -Site Builder- SSH support - Account Migration
    DowntownHost LLC - In Business since 2001- West/Center/East USA - Netherlands - Singapore

  3. #3
    Join Date
    Oct 2004
    Location
    India
    Posts
    509
    As Mentioned by Jedito, you need to place the file in correct cgi directory with proper permission and ownership.
    ESC :wq!

  4. #4
    Join Date
    Nov 2004
    Location
    Northamptonshire
    Posts
    56
    Another thing to check:
    If you are uploading via. FTP make sure ASCII mode is on. The perl interpreter doesn't like /r/n codes.
    Andrew Hutchings (A-Wing) - Linux Jedi
    A-Wing Internet Services
    Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

  5. #5
    Join Date
    Oct 2004
    Location
    India
    Posts
    509
    Quote Originally Posted by A-Wing
    Another thing to check:
    If you are uploading via. FTP make sure ASCII mode is on. The perl interpreter doesn't like /r/n codes.
    Very much true.
    ESC :wq!

  6. #6
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,771
    And the error log might give you more details.
    Ssh to the server and tail the apache error log while you take the page in the browser. It might give you a clearer picture.

  7. #7
    Quote Originally Posted by A-Wing
    Another thing to check:
    If you are uploading via. FTP make sure ASCII mode is on. The perl interpreter doesn't like /r/n codes.
    That was it !!

    thanks, something so stupid causes all these problems.

    thanks very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •