Re: Problem with Exec()

From: Date: Sat, 13 Jan 2001 00:58:27 +0000
Subject: Re: Problem with Exec()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-34343@lists.php.net to get a copy of this message
It should also be noted that the system interaction functions (namely, passthru(), exec(), system() and popen()) are broken/incorrectly implemented, actually, its windows that's incorrectly implemented, but be that as it may, the functions do not work with windows). To the original poster: Use PHP's built-in mail() function instead, don't fork out to sendmail, actually, better yet, use linux :-). -Sterling Richard Lynch wrote: > > 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 <JHaworth@witanjardine.co.uk> > 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: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#34343) next »