CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: mod_perl:
Perl CGI script doesn't execute

 



pranavkojha
New User

Feb 24, 2008, 8:14 AM

Post #1 of 4 (12658 views)
Perl CGI script doesn't execute Can't Post

I am not able to get desired output in HTML using a small perl script. When I execute the below script it outputs the text fine (using 'perl test.pl' command). However, on my browser, when I key in the address of the script "http://localhost/test.pl", I get output as the script itself. I have given the execute permission for the script but it still doesn't work, also the path of 'perl' is correct. I just want the output as "Perl works!". Here is the script I have been working on,

Code
************************** 
#! /usr/bin/perl

use strict;
use CGI':standard';

print "Content-type:text/html","\n\n";
print "<html><body>";
print "<br>";
print "Perl works!";
print "</body></html>";
**************************

Any help?
System info:
Fedora core 5
Apache server


KevinR
Veteran


Feb 24, 2008, 12:17 PM

Post #2 of 4 (12655 views)
Re: [pranavkojha] Perl CGI script doesn't execute [In reply to] Can't Post

Normally scripts go in the cgi-bin, not in the root www directory although the server could be setup like that if you wanted to. Google for a tutorial for your specific http server and read about setting it up to run scripts. There are a lot of forums that discuss server topics too so you may want to find a forum that has a topic area for apache.
-------------------------------------------------


hydpm
User

Mar 12, 2008, 2:57 PM

Post #3 of 4 (12623 views)
Re: [pranavkojha] Perl CGI script doesn't execute [In reply to] Can't Post

make sure the file is in cgi-bin folder. Check in httpd.conf file, the value for the Script Alias for cgi-bin path.

Then check the permission of the file

in the url : http://<host>/cgi-bin/test.pl


KevinR
Veteran


Mar 13, 2008, 12:36 AM

Post #4 of 4 (12621 views)
Re: [pranavkojha] Perl CGI script doesn't execute [In reply to] Can't Post

not sure if the space in the shebang line would be a problem but I would remove it:

#! /usr/bin/perl

should be:

#!/usr/bin/perl
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives