PDA

View Full Version : can u guys help me....


mbkarmakar2004
10-08-2007, 06:02 AM
I am facing a problem in running a perl program in web browser in linux machines... A simple program i hav tried 2 run like dis:-

#!/usr/bin/perl -w
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
$cgi=new CGI();
print $cgi->header();
warningsToBrowser(1);
unlink("/var/www/cgi-bin/flag.txt");
open (FLAG,">/var/www/cgi-bin/flag.txt");
print FLAG "flag=1;";
close(FLAG);


We have many machines containing fedora core 4 and 6 linux in our lab...But the above program ,when i run in web browser,is running successfully in only 2 machines (i fedora core 4 n other one 6)...but r not running in other machines although all have the same configuration i.e.,the file "flag.txt" is not being created in those machines....but when i am running that in terminal by the perl command it is running i.e.,the file is being created....


Do i need 2 change any setting or have 2 write anything more 2 make the program run in all machines?????
:confused: Plz guys help me...... Plzzzzzzz.....

FishMonger
10-08-2007, 06:38 AM
Telling us that it's not working is not enough info.

What part is not working?
Are you receiving an error? If so, what's the error?

Why aren't you using the warnings and strict pragmas and why aren't you checking the return value of the open call?

FishMonger
10-08-2007, 07:09 AM
Change your open call to this and you'll see why your script is not doing what you expect.

open (FLAG, ">/var/www/cgi-bin/flag.txt") || die $!;

KevinADC
10-08-2007, 10:10 AM
probably a permissions problem. Try Fishmongers suggestion and that should confirm it.