30 users online (1 members and 29 guests)  


  Results 1 to 3 of 3

Related

  1. Need help with perl    Forum: CGI Perl Forum
    Replies: 1
  2. Replies: 1
  3. Replies: 1
  4. Replies: 0
  1. #1
    rajadilly's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    2

    How to run Perl-cgi.

    I typed the perl program in the notepad and saved it with .cgi extension. I have the apache web server. I dont know how to execute that cgi program. I need how to execute this in step by step.

  2. #2
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: How to run Perl-cgi.

    Quote Originally Posted by rajadilly
    I typed the perl program in the notepad and saved it with .cgi extension. I have the apache web server. I dont know how to execute that cgi program. I need how to execute this in step by step.
    Are you a Windows or Linux/Unix user? I'm not up to speed on Windows perl, but for Linux:

    Do you have the shebang on the first line?

    #!/usr/bin/perl
    or
    #!/usr/local/bin/perl

    Did you do a chmod +x filename?

    Is the script in the /var/www/cgi-bin/? or from a directory listed in /etc/apache/httpd.conf as ExecCGI?

    Can, from the command line, you run the program as ./filename ?

    If yes to all these questions, then you should be able to run it like this:

    netscape (or lynx, mozilla, etc) localhost/cgi-bin/filename

    If that does not run it, then you need to check your /var/log/apache/error to see what happened. It will be on the last couple of lines in the log.

    I run Slackware and the above are the paths that I use. ymmv

    hth

    uthus

  3. #3
    TechDeano's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2013
    Posts
    1

    Cool Re: How to run Perl-cgi.

    Quote Originally Posted by uthus View Post
    Are you a Windows or Linux/Unix user? I'm not up to speed on Windows perl, but for Linux:

    Do you have the shebang on the first line?

    #!/usr/bin/perl
    or
    #!/usr/local/bin/perl

    Did you do a chmod +x filename?

    Is the script in the /var/www/cgi-bin/? or from a directory listed in /etc/apache/httpd.conf as ExecCGI?

    Can, from the command line, you run the program as ./filename ?

    If yes to all these questions, then you should be able to run it like this:

    netscape (or lynx, mozilla, etc) localhost/cgi-bin/filename

    If that does not run it, then you need to check your /var/log/apache/error to see what happened. It will be on the last couple of lines in the log.

    I run Slackware and the above are the paths that I use. ymmv

    hth

    uthus
    uthus Hello

    I wonder if you might help me, I have brought a Raspberry Pi, Installed Debian Whizzy OS, perl and apache2, then I copied over a script I wrote.

    I do the ./shop.cgi in the command line and get a result as expected (located in /var/www/shop/shop.cgi)
    When I call the script in the browser I get the text contents of the .cgi file e.g." #!/usr/bin/perl print "Content-type: text/html\n\n"; $actionoveride=0; if($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN . . . ."

    Then when I click reload in the browser I get
    "Forbidden
    You don't have permission to access /shop/shop.cgi on this server.


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

    Apache/2.2.22 (Debian) Server at 192.168.1.141 Port 80"

    I know it's gotta be some config / ownership thing but I really don't have enough knowledge on the whole perl Apache thing, but am keen to sort it out. The script runs fine on the hosted service from my ISP

    Any suggestions would be greatly appreciated

    Regards
    Deano



Tags for this Thread