Web Servers on Windows - Perl and Apache, running system commands...

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Windows > January 2007 > Perl and Apache, running system commands...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Perl and Apache, running system commands...
gocaveman

2007-01-29, 7:20 pm

I need to make a system call within a cgi script, and I am having some
trouble. I know that I have done this before, but for some reason,
when I make the call, things hang, and the debug just before my system
call gets printed, but the debug after never gets printed.

I made s short .pl script, which works fine when I call "perl
system.pl" at the command prompt.
system.pl:
#!/usr/local/bin/Perl/bin/perl.exe -w
my $SUCCESS = 0;

my $cmd = "notepad.exe \"error.log\"";
(system($cmd) == $SUCCESS) or print("Notepad failed: $!\n");

Now, within the confines of my cgi script (running win32 with apache),
I am trying ($ME is defined to "filename.cgi:"):
don_common'log_to_file($msg_log, "$ME about to make notepad call");
my $cmd = "notepad.exe \"error.log\"";
(system($cmd) == $SUCCESS) or don_common'log_to_file("notepad failed:
$!\n");
don_common'log_to_file($msg_log, "$ME just made notepad call");

In my log file, I get the following output:
filename.cgi: about to make notepad call

Any ideas? I even tried to put a copy of notepad.exe in my cgi-bin
directory. The error.log is also in the same directory.

Thanks,

-Kevin

gocaveman

2007-01-29, 7:20 pm

Even more interesting, is that notepad is apparently being called,
since it is in the process list, but the gui for notepad never gets
raised to the point to where it is displayed anywhere. Of course
after this point, Apache will wait for notepad to exit, which never
happens, and at some point goes into the error log when Apache
terminates the thread.

So, I tried closing STDIN and STDOUT, but it makes no difference. Any
ideas?

On Jan 29, 3:34 pm, "gocaveman" <kevinwh...@bellsouth.net> wrote:
> I need to make a system call within a cgi script, and I am having some
> trouble. I know that I have done this before, but for some reason,
> when I make the call, things hang, and the debug just before my system
> call gets printed, but the debug after never gets printed.
>
> I made s short .pl script, which works fine when I call "perl
> system.pl" at the command prompt.
> system.pl:
> #!/usr/local/bin/Perl/bin/perl.exe -w
> my $SUCCESS = 0;
>
> my $cmd = "notepad.exe \"error.log\"";
> (system($cmd) == $SUCCESS) or print("Notepad failed: $!\n");
>
> Now, within the confines of my cgi script (running win32 with apache),
> I am trying ($ME is defined to "filename.cgi:"):
> don_common'log_to_file($msg_log, "$ME about to make notepad call");
> my $cmd = "notepad.exe \"error.log\"";
> (system($cmd) == $SUCCESS) or don_common'log_to_file("notepad failed:
> $!\n");
> don_common'log_to_file($msg_log, "$ME just made notepad call");
>
> In my log file, I get the following output:
> filename.cgi: about to make notepad call
>
> Any ideas? I even tried to put a copy of notepad.exe in my cgi-bin
> directory. The error.log is also in the same directory.
>
> Thanks,
>
> -Kevin


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com