RE: exec() problem

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

 



To clarify it a little bit more, I have changed the code a bit:

$command = "nslookup -type=mx $domain 2>&1";

exec ( $command, $result );

print_r($result);

And the result on the browser is:

Array ( [0] => Access is denied. ) 

Any clues?

 '>'-- Mensagem Original --
 '>'Date: Tue, 20 Dec 2005 10:43:48 -0200
 '>'From: Fábio Ottolini <fabio.ottolini@xxxxxxxxx>
 '>'Reply-To: fabio.ottolini@xxxxxxxxx
 '>'To: php-windows@xxxxxxxxxxxxx
 '>'Subject:  exec() problem
 '>'
 '>'
 '>'Dear Comrades,
 '>'
 '>'Can someone please explain why this 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
 '>'

-- 
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