Re: Redirecting STDERR to a file?
| From: | Richard Lynch | Date: | Mon, 04 Feb 2008 03:08:48 +0000 |
| Subject: | Re: Redirecting STDERR to a file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268616@lists.php.net to get a copy of this message | ||
On Fri, February 1, 2008 10:58 pm, js wrote:
> Hi,
>
> I was trying to write a script in PHP that takes a program name
> as an argument and invoke it as a daemon.
> PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
> so it was easy.
> However, I couldn't find a way to redirect STDERR a file.
> I like to have the daemon write its log to its own logfile, like
> apache and mysql do.
>
> So is there any way to accomplish that?
> Any pointers, suggestions would be greatly appreciated.
http://php.net/set_error_handler
You can catch (almost) all the errors and send them wherever you want.
Or maybe you just want to write this as a shell script instead of
using PHP in the first place. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?