CGI not working

Discussion in 'Programming' started by georgechristodoulou, Dec 1, 2006.

  1. #1
    need help!!!.....when i make a Perl script, it works in the terminal, but when i code it as a cgi, save it as a .cgi, put it in cgi-bin and open it in mozilla it just doesnt work...it shows the actual code. so i went to the books and looked up why and it didnt make any sense.....can somebody help please???thanks...late
     
    georgechristodoulou, Dec 1, 2006 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What happens if you give it a .pl extension? Also, make sure that the execute bit is set (chmod the file to something like 755).

    If neither of those work, I'd contact the host if I were you.
     
    TwistMyArm, Dec 1, 2006 IP
  3. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Changing the permissions on the script is important for making it executible.

    But, your web server is not recognizing the *.cgi script as something which needs to be executed before the page is served.

    There are two possible causes: your server is not configured to recognize perl or you do not have the correct path to your perl executible in the first line of the script.

    Under *nix the first line of the perl script needs to be something like:

    #/usr/local/bin/perl

    You can find the path by going to command line on your server and entering "whereis perl"

    If you cannot check/modify the httpd.conf file, then you will need to ask your ISP about their support for perl CGI scripts.

    The following lines need to exist -- assuming you have an Apache server -- and not be commented out:

    LoadModule cgi_module modules/mod_cgi.so
    AddHandler cgi-script .cgi

    That last line might also have .pl and even .php in it.
     
    clancey, Dec 1, 2006 IP