How does error_log open the file?
| From: | mike | Date: | Mon, 04 Aug 2008 07:52:32 +0000 |
| Subject: | How does error_log open the file? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39600@lists.php.net to get a copy of this message | ||
I'm curious as to how error_log is opened...
Is it opened when an error occurs, as in open/append to, or is the
file handle kept open when the PHP fastcgi process is spawned?
Essentially I want to be able to provide each client their own PHP
error log, i.e.
/home/client1/php-error.log
But I have multiple webservers (3 of them currently) serving up PHP
content. Can I point all 3 to that same place? Or will they try to
issue locks and create a bunch of thrash? if it just creates/appends
on each error instance that would be perfect.
I am using php-fpm w/ 5.2.6, and NFS is used for central storage,
mapped as /home to all the webservers.
I figured you internals guys would know exactly how it works, I don't
know C well enough to pick through the code and understand this fully.
I think it's in main/main.c:
fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644);
From what I can tell. Although I don't know where to look to see if it
persists, but I am thinking it is safe to assume every error that
occurs triggers this php_log_err() function... any help is
appreciated.
Thanks,
mike