Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.
Moderator: General Moderators
new2thenet
Forum Newbie
Posts: 3 Joined: Tue Feb 12, 2008 3:12 pm
Post
by new2thenet » Tue Feb 12, 2008 3:28 pm
I ran the following code on a Ubuntu box running Apache/PHP and was told the SSH keys have been corrupted (and my code was the culprit.) Can anyone please tell me if there's something I should include/declude in this to prevent another issue...or this SSH issue even related to my attempts at a PHP interface for CL applications?
Code: Select all
$mtr_host = $_GET['Host'];
$mtr_packets = $_GET['Packets'];
$fp = popen("mtr -c $mtr_packets --report $mtr_host 2>&1","r");
// ping 20 times, interval 1 second
while (!feof($fp)) {
set_time_limit (120);
$results = fgets($fp, 256);
if (strlen($results) == 0) {
// stop the browser timing out
echo " ";
flush();
} else {
$tok = strtok($results, "\n");
while ($tok !== false) {
echo htmlentities(sprintf("%s\n",$tok))."<br/>"; flush();
$tok = strtok("\n");
}
}
// avoid a busy wait
sleep(1);
}
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Wed Feb 13, 2008 3:44 am
I can't see anything related to SSH in your code. Use sudo to execute mtr - you need root privileges in order to get raw socket.
There are 10 types of people in this world, those who understand binary and those who don't