PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Cannot Net_Ping::ping() from inside Apache

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Networking
View previous topic :: View next topic  
Author Message
squirrel



Joined: 29 Mar 2007
Posts: 1

PostPosted: Thu Mar 29, 2007 8:40 pm    Post subject: Cannot Net_Ping::ping() from inside Apache Reply with quote

I'm writing a web app that attempts to ping a system on the network to determine if the system is alive. When I run the following code from the console, things work great:

Code:
<?php

require_once('Net/Ping.php');

$ping = Net_Ping::factory();

$address = '192.168.1.1';

$result = $ping->ping($address);
if ( PEAR::isError($result) ) {
   echo "Host is not up (";
   echo $result->getMessage;
   echo ")\n";
} else {
   echo "Host is up and replied (";
   echo $result->getReceived();
   echo ")\n";
}

?>


Result:
Quote:
Host is up and replied (3)


When I try to run the same code under Apache 2.2.3 on Fedora Core 6 (PHP version 5.1.6), the Net_Ping::ping() command always returns with an 'unknown host' error.

Any advice on how to fix this?

Thanks!
Chris
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Networking All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software