exec cmd=perl... work but exec cgi doenst
This HTML entry
<!--#exec cmd="perl /var/www/cgi-bin/count.cgi" --> works fine!!! This one: <!--#exec cgi="/cgi-bin/count.cgi" --> Does not work and give me those errors at log: [Wed Dec 7 16:05:51-2005] [error] (2)No such file or directory: exec of /var/www/cgi-bin/count.cgi failed [Wed Dec 7 16:05:51-2005] [error] [client 192.168.168.101] Premature end of script headers: /var/www/cgi-bin/count.cgi This is the count.cgi: #!/usr/local/bin/perl # Gif images should be named as 0.gif, 1.gif, ..., 9.gif # $| = 1; $image = "pics/counter"; $count = "/var/www/cgi-bin/count.txt"; # Get counter number and increment it open(COUNT,"$count") || die "Can't open count data file for Reading: $!\n"; $c = <COUNT> ; close(COUNT); if ($count =~ /\n$/) { chop($c); } $c++; open(COUNT,">$count") || die "Can't open count data file for Writing: $!\n"; print COUNT "$c"; close(COUNT); # Determine counter width $num = $length = length($c); # Set Individual Counter Numbers Into Associative Array while ($num > 0) { $CHAR{$num} = chop($c); $num--; } # Output gif images to Web server $j = 1; print "<img src=$image/0.gif>"; print "<img src=$image/0.gif>"; while ($j <= $length) { print "<img src=$image/$CHAR{$j}\.gif>"; $j++; } ________________________________________ Could some one tell me why????????? |
Sound to me that you have a permissions problem, check the httpd.conf to see if the cgi folder has been set correctly and then check if the cgi is executable for the httpd user.
|
Forget to mention. Permissions were ok. Problem remains.
If the permissions were not properly set, I would not be able to run it with <!---#exec cmd="perl.... Is the SAME script. Tks. |
Before you write anything back you should include a content-type header:
print "content-type:text/html\n\n"; |
Dear friends,
When I type at the prompt: perl -w count.cgi it returns: <img src=pics/counter/0.gif><img src=pics/counter/0.gif><img src=pics/counter/4.gif><img src=pics/counter/2.gif><img src=pics/counter/2.gif><img src=pics/counter/2.gif><img src=pics/counter/7.gif> AND it is working :eek: without the: print "content-type:text/html\n\n"; WHITIN THE index.html page. I have included this line BUT THE ERROR REMAINS.:scratch: The script is at /var/www/cgi-bin/ All permissions are ok (otherwise it would not run with perl) It IS WORKING BUT ONLY WITH: #exec cmd="perl ....." When I point to the same script with CGI's <--!#exec cgi="... :cry: |
Hello folks,
Got it to work: My first line :newbie: was WRONG!!! IT MUST BE #!/usr/bin/perl. (I'm in Slackware) Sorry for all the trouble and thank you all for the tips!!! Linux rules. Merry Xmas and Happy new Year. :D :D :D |
All times are GMT -5. The time now is 02:41 PM. |