Page 1 of 1
fsockopen() Premission denied 13
Posted: Sun Oct 22, 2006 7:21 pm
by kendall
Hey guys,
on a local server of mines im doing a whois is look up using the fsockopen function which returns successfully. However, on trying to use it on a live site. I get a PHP warning saying that it was unable to connect and also return the error string 'Permission denied' and the #13
any explanations on this? any work arounds?
Kendall
Posted: Sun Oct 22, 2006 9:41 pm
by akimm
Make sure you're CHMOD 755 at least.
What is your exact purpose for the whois search, are you searching a DB or a flatfile, searching the web pages, or what?
Posted: Mon Oct 23, 2006 8:27 am
by kendall
Make sure you're CHMOD 755 at least.
what do you mean?
I'm running a whois search on a web page i think... it's the typically way they go about doing this whois thing
Kendall
Posted: Tue Oct 24, 2006 4:57 pm
by feyd
I don't think whois services query (via a page) other services, most will use the system level request to a DNS server.
shell_exec() et al.
Posted: Wed Oct 25, 2006 8:12 am
by kendall
I don't think whois services query (via a page) other services, most will use the system level request to a DNS server.
shell_exec() et al.
Ok you've thrown me off the track with that one man....what r you trying to say here? I don't know but I use fsockopen() as a tool to get whois information from a whois server. Its working on my local server but not on my live server. what does shell_exe() have to do with this?
Kendall
Posted: Wed Oct 25, 2006 8:17 am
by volka
Please post your code and the exact error message(s).
Posted: Wed Oct 25, 2006 8:42 am
by kendall
Code: Select all
$TLDservers = array("com"=>"whois.crsnic.net","net"=>"whois.crsnic.net","org"=>"whois.publicinterestregistry.net","info"=>"whois.afilias.info","biz"=>"whois.neulevel.biz");
//whois query
function LOOK_UP($server = false,$domain,$record = false){
$errno = 0;
$errstr = '';
// if look up record only
if($record == true){
//look up domain records
$record = checkdnsrr($domain);
return $record;
}else{
// look up domain registrants
$port = 43;
$fp = fsockopen($server,$port,$errno,$errstr,30);
if(!$fp){
//return $errstr.' '.$errno;
return false;
}else{
fputs($fp, "$domain\r\n");
while(!feof($fp)) {
$data .= fgets($fp,128);
}
fclose($fp);
}
//echo $data;
if($data != false)
return strstr($data,'Domain Name');
else
return false;
}
}
//print(LOOK_UP($_GET['server'],$_GET['domain'],$record = false));
?>
PHP Warning: fsockopen(): unable to connect to whois.crsnic.net:43 in
and i get that
return $errstr.' '.$errno; //prints out Permission denied 13
Posted: Wed Oct 25, 2006 8:57 am
by volka
I think you have to ask the provider why the connection is blocked.
Posted: Wed Oct 25, 2006 10:58 am
by Mordred
Wait, this works on your local machine, but not on your hosting? If so there are some restrictions on remote connections on your hosting. I don't remember what the relevant settings are - but you can see if there is something apparent in phpinfo(). Does somebody know what hostings do to forbid socket operations and how to check if this is the case?
Posted: Wed Oct 25, 2006 11:11 am
by Cameri
I've run in to those kind of problems before... the thing is that the webserver usually has all the ports closed except those like 80, 21, etc. But I'm not sure if this is the cause of your problem.
Contact your web host and ask them to enable port 43 for you.