By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

php exec and nslookup

100+
P: 111
Hi I have been trying to use the php exec and nslookup for DNS lookups on a windows platform.

but whenever i execute the code i get the following error:
Unable to fork [nslookup -type=MX yahoo.com]

I am pretty sure that the code i'm using is ok.

I've come across a few sites that have said that the most probably answer is to set read + execute permissions on the exe.
I have no idea what this is or how to do this, any ideas?

also, is there a setting in the php.ini that i may need to edit.


the code that i'm using for the exec() is
[PHP]function customCheckDnsrr($host,$recType='') {
if(!empty($host)) {
if($recType=='')
$recType="MX";
exec("nslookup -type=$recType $host",$output);
foreach($output as $line) {
if(preg_match("/^$host/", $line)) {
return true;
}
}
return false;
}
return false;
}[/PHP]

where for testing i'm using $host as yahoo.com, as the input parameter.
Jan 9 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 111
does anyone know how to fix this,, or guide me in the right direction
Jan 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.