Perl and Apache, running system commands...
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Web Servers on Windows > Perl and Apache, running system commands...




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Perl and Apache, running system commands...  
gocaveman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:20 AM

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






[ Post a follow-up to this message ]



    Re: PERL and Apache, running system commands...  
gocaveman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:20 AM

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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:46 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register