LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2005, 02:52 AM   #1
avswamy
LQ Newbie
 
Registered: Jan 2005
Posts: 3

Rep: Reputation: 0
Lightbulb 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
 
Old 01-30-2005, 06:44 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Your script runs without problems after copy/paste verbatim on my Debian PC with Apache 1.3.33 and PHP 4.3.10.

Maybe you're system uses a "ping" that doesn't support the command line switches you use? I can't think of something else.

Have you tried to run the "ping" command as output by: print"$cmd $count $host"; ?
 
Old 01-31-2005, 04:30 AM   #3
avswamy
LQ Newbie
 
Registered: Jan 2005
Posts: 3

Original Poster
Rep: Reputation: 0
yes it is printing as
ping -c 4 172.20.0.1

i think, the command is not executing.
 
Old 01-31-2005, 04:55 AM   #4
avswamy
LQ Newbie
 
Registered: Jan 2005
Posts: 3

Original Poster
Rep: Reputation: 0
It has to display after ping -c 4 172.25.0.1

this
Pinging 61.246.213.206 with 32 bytes of data:

after this i should get Reply----but i am not getting this display
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command execution time minil Programming 10 08-20-2010 04:59 PM
can I check the execution of this command? kushalkoolwal Programming 1 10-21-2005 08:44 PM
command execution leonidas Linux - General 1 09-22-2004 12:29 AM
could not open session problem in linux during su - command execution selvaraju Linux - Security 2 08-21-2004 11:24 AM
PHP execution from home directory orinjus Linux - Software 4 11-26-2003 06:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration