php command execution problem
i am trying to execute this script, while executing this scrip i am not getting the output, my php version is 4.3.7 and linux version is FEDORA 2.
While with print command it is showing ping -c 4 172.50.0.101, is it executing or not. if executing then why it is not showing the output on browser. while i tried to enter more than 10 in count, it is showing the error as max count is 10, so the script upto some point is executing. I am not able to find it is stucking, can any one help me out in this. I am able to execute the same script in windows without any problem. While using same with Linux box in Fedora is giving problem. Here i am using with default configuration, and test.php with phpinfo(); it is showing test page.
Thank you all for the so much of info.
<?php
$max_count = "10"; //maximum count for ping command
$cmd = "ping -c"; // unix (unix means all flavors of linux as well)
//$cmd = "ping -n"; // windows
//$cmd = "tping -c"; // netware
// -------------------------
//
// nothing more to be done.
If (isset($_POST['submit'])) {
If ($_POST['count'] > $max_count)
{
echo 'Maximum for count is '.$max_count;
echo '<a href="10.10.0.12">Back</a>';
$again = True;
}
else
{
If (ereg(" ",$_POST['host']))
{
echo 'No Space in Host field allowed !';
echo '<a href="10.10.0.12">Back</a>';
$again= True;
}
else
{
echo("<b><font color=\"00cf10\">Connectivity Test to a Subscriber in Zone I Output:</font></b><br>");
echo("<pre>");
// $host = escapeshellarg($_POST['host']);
// $count = escapeshellarg($_POST['count']);
$host = $_POST['host'];
$count = $_POST['count'];
print"$cmd $count $host";
system("$cmd $count $host", $list);
echo("</pre>");
}
}
}
else
{
?>
<html>
<title>This site is Designed and Maintained by Swamy</title>
<body>
<h3><font color=\"00cf10\">Connectivity Test to a Subscriber in Zone I</font></h3>
<h4><font color=\"00cf8\">IP Address in Banjara Hills, series should be ---172.25.0.0</font></h4>
<h4><font color=\"00cf8\">IP Address in Khairatabad/Somajiguda/Erramanzil, series should be ----172.26.0.0</font></h4>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Enter IP or Host <input type="text" name="host"></input>
Enter Count <input type="text" name="count" size="2" value="4"></input>
<input type="submit" name="submit" value="Test"></input>
</form>
<?php
}
?>
<a href="/downloads/index.php"><img src=images/alerts.gif width=36 height=35 border=1 alt="Downloads"></a>
</body></html>
php command execution problem
|