Re: execute a command
| From: | Don Read | Date: | Sun, 22 Jun 2003 23:07:30 +0000 |
| Subject: | Re: execute a command | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152461@lists.php.net to get a copy of this message | ||
On 22-Jun-2003 Mattia wrote:
> How to execute a command capturing the stanndard error, in addition to
> standard output? example:
>
> echo system('/bin/rm ...');
>
> I need to know when this command fails, and when it fails, i need to
> know why. Any hints?
>
> _Mattia_
>
$cmd='/bin/rm foo';
exec("$cmd 2>&1", $output);
-- or --
exec($cmd, $output, $errno);
echo posix_strerror($errno);
-- or --
proc_open(...) and read from pipe[2]
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)