First, make sure that sendmail is something the iUSR_machinename can run --
Just because you logged in as you can run it doesn't mean that the user that
Apache/PHP is running as can run it.

Next, forget about that goofy DOS backslash thing.  Just use "/" for your
paths.

Finally, add the optional arguments to exec()
exec("d:/sendmail/sendmail.exe -t -messagefile=d:/sendmail/msg.txt",
$results, $error);
while (list(,$line) = each($results)){
    echo $line, "<BR>\n";
}
if ($error){
    echo "OS Error $error.  Usually path/permissions.<BR>\n":
}


----- Original Message -----
From: Jon Haworth <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, January 12, 2001 10:13 AM
Subject: [PHP] Problem with Exec()


> Hello list,
>
> I'm having a problem with Exec and Sendmail, on PHP-4 running under Apache
> 1.3.14 on Windows NT.
>
> When I go to a DOS prompt and enter
>
> d:\sendmail\sendmail -t -messagefile=d:\sendmail\msg.txt
>
> it works fine. When I have any of the lines
>
> exec ("d:\sendmail\sendmail.exe -t -messagefile=d:\sendmail\msg.txt");
> exec ("d:\\sendmail\\sendmail.exe -t -messagefile=d:\\sendmail\\msg.txt");
> $foo = exec ("d:\sendmail\sendmail.exe -t
> -messagefile=d:\sendmail\msg.txt");
> $foo = exec ("d:\\sendmail\\sendmail.exe -t
> -messagefile=d:\\sendmail\\msg.txt");
>
> all that happens is my PHP script times out. If I remove this line,
> everything works fine. I'm sure I'm missing something simple but I'm
*very*
> tired. Any ideas?
>
>
> Cheers
> Jon
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to