Re: problem with external command.

From: Date: Mon, 22 Sep 2003 17:24:33 +0000
Subject: Re: problem with external command.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163508@lists.php.net to get a copy of this message
Jeremy Russell wrote:
Everything seems to work fine with this function except that when the command runs and is to populate the "$scan_result" field. It doesn't Im not sure why either. I also get an "End of file unexepected" error in my apache logs as well. Anybody have any advice.
Have you tried running this command as the user your web server is running as? You need root privileges for some of the options you want. [snip]
function scanner($scan,$opt,$ip,$log,$echo,$mail) {
    $cmd = "$scan  $opt $ip <br>";
    print "This is the command: <br> $cmd<br><br>\n";
    $scan_result =  exec("$cmd");
    print "This should be the scan : <br> $scan_result<br>";
    $filename = "$log";
    $fileid = fopen("$filename","a");
    fputs($fileid,"$scan_result\n");
    fclose($fileid);
    //$mail_result =`$echo $scan_result | $mail -s "Hostile Node"
$admin`; } /* end scanner() */
You have a <br> in $cmd. That will likely cause problems. - Brad

« previous php.general (#163508) next »