0

Perl/apache if we run the Perl script on apache for display the result of Linux command it is not able to execute the Linux command and not display it into the browser.

eg. We want to display the result of "ping" command but not able to identify what is the problem on my apache it doesn't display the result but in command line it displays the result.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mitchems
0

Does the apache user have the right to execute the command? You should post the code. You probably want to redirect stdout to a variable too and then print the variable.

0

On windows/apache this works fine as a cgi program:

#!c:/perl/bin/perl.exe
print "Content-type: text/html\n\n";

print "Ping:<br><pre>";

system("ping www.yahoo.com");

print "</pre>";

output:

Ping:

Pinging any-fp.wa1.b.yahoo.com [209.191.122.70] with 32 bytes of data:
Reply from 209.191.122.70: bytes=32 time=62ms TTL=38
Reply from 209.191.122.70: bytes=32 time=61ms TTL=38
Reply from 209.191.122.70: bytes=32 time=61ms TTL=38
Reply from 209.191.122.70: bytes=32 time=61ms TTL=38

Ping statistics for 209.191.122.70:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:
Minimum = 61ms, Maximum = 62ms, Average = 61ms
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.