exec() problem

From: Date: Tue, 20 Dec 2005 12:43:48 +0000
Subject: exec() problem
Groups: php.windows 
Request: Send a blank email to php-windows+get-26583@lists.php.net to get a copy of this message
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@globo.com"; 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

« previous php.windows (#26583) next »