exec() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Comrades,

Can someone please explain why this is script is not working on my win2k
box with PHP 4.3.4?

<?php

$email="fabio.ottolini@xxxxxxxxx";

list($alias, $domain) = split("@", $email); 

$command = "nslookup -type=mx $domain";

exec ( $command, $result );

$i = 0;
while ( list ( $key, $value ) = each ( $result ) ) {
   if ( strstr ( $value, "mail exchanger" ) ) { $nslookup[$i] = $value;
$i++; }
}
   
while ( list ( $key, $value ) = each ( $nslookup ) ) {
   $temp = explode ( " ", $value );
   $mx[$key][0] = $temp[3];
   $mx[$key][1] = $temp[7];
   $mx[$key][2] = gethostbyname ( $temp[7] );
}

   array_multisort ( $mx );

	print_r($mx);
	print "<br><br>";
	print $mx[0][1];

?>

The same script works fine in another win2k box running PHP version 5. Strange
is that if I add print $result; right after exec ( $command, $result );
nothing is printed. When the script runs on the machine that works it prints
Array obviously. So, my guess is that $command is never being executed.
BTW, PHP is not running on safe_mode and the nslookup command works fine
on both machines.

Any help would be very much appreciated.

Kind Regards,

Fabio Ottolini

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux