Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 01-30-2005, 03:52 AM   #1
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, 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.

$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="">Back</a>';
$again = True;
If (ereg(" ",$_POST['host']))
echo 'No Space in Host field allowed !';
echo '<a href="">Back</a>';
$again= True;
echo("<b><font color=\"00cf10\">Connectivity Test to a Subscriber in Zone I Output:</font></b><br>");
// $host = escapeshellarg($_POST['host']);
// $count = escapeshellarg($_POST['count']);
$host = $_POST['host'];
$count = $_POST['count'];
print"$cmd $count $host";
system("$cmd $count $host", $list);


<title>This site is Designed and Maintained by Swamy</title>
<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 ---</font></h4>
<h4><font color=\"00cf8\">IP Address in Khairatabad/Somajiguda/Erramanzil, series should be ----</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>
<a href="/downloads/index.php"><img src=images/alerts.gif width=36 height=35 border=1 alt="Downloads"></a>
php command execution problem
Old 01-30-2005, 07:44 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
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, 05:30 AM   #3
LQ Newbie
Registered: Jan 2005
Posts: 3

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

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

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

Pinging with 32 bytes of data:

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:59 PM
can I check the execution of this command? kushalkoolwal Programming 1 10-21-2005 09:44 PM
command execution leonidas Linux - General 1 09-22-2004 01:29 AM
could not open session problem in linux during su - command execution selvaraju Linux - Security 2 08-21-2004 12:24 PM
PHP execution from home directory orinjus Linux - Software 4 11-26-2003 07:28 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 AM.

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