Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: cgi works locally, but not on web server

by bibo (Pilgrim)
on Jun 17, 2004 at 03:30 UTC ( [id://367518]=note: print w/replies, xml ) Need Help??


in reply to cgi works locally, but not on web server

I see by this being your third post that you really really really want this to work. OK, I applaud your tenacity.

First, I don't see a complete HTML document here, no headers, etc. Did you edit that out, or are you really using perl to print just the form and not the whole html?

Have you tried just a "hello.cgi" thing to make sure that Apache2 is running the script at all? (although your output would indicate it is doing so)

Next, can your "hello.cgi" script just open and print a line from a textfile in the same subdir as your db files? This would tell us if somehow Apache2 is preventing you from accessing the files there.

Here is an example, adjust as needed and put in your same CGI subdir:

#!/usr/bin/perl use strict; # fix this filename to match a small file in your db dir my $filename = "/var/www/cgibin/local/clotdesnew1db/file.txt"; # print "Content-type: text/plain\n\n"; print "Hello world\n"; print "filename is $filename\n"; # after first test completes, uncomment the next 5 lines #my @junk; #open(JUNK, $filename)|| die "Cannot open file $filename!"; #@junk = <JUNK>; #close(JUNK); #print "Line 1: $junk[0] \n";
When I ran it here, I got output like this:
Hello world filename is /var/www/cgi-bin/test1.txt Line 1: Dear brother:
Let us know if this works or not, or what your tests tell you...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-24 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found