|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51304 php://stderr stream logs to global apache log file instead of virtual host file
Submitted: 2010-03-15 22:24 UTC Modified: 2014-04-03 10:30 UTC
Avg. Score:4.4 ± 0.7
Reproduced:10 of 10 (100.0%)
Same Version:2 (20.0%)
Same OS:3 (30.0%)
From: houdelou at hotmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: Irrelevant OS: Ubuntu Server 9.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: houdelou at hotmail dot com
New email:
PHP Version: OS:


 [2010-03-15 22:24 UTC] houdelou at hotmail dot com
PHP 5.2.6-3ubuntu4.5 with Suhosin-Patch (cli) (built: Jan  6 2010 22:25:33)

/* This logs to global apache error_log file. */
$log = fopen("php://stderr", "a"); 
fwrite($log, "test message"); 

/* This logs to virtual host error_log file */
trigger_error("test message");

php.ini settings :
log_errors = On
No value for error_log. It is commented out.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-19 14:42 UTC]
-Status: Open +Status: Feedback
 [2010-05-19 14:42 UTC]
Please try using this snapshot:
For Windows:

 [2010-06-24 10:25 UTC] viatkine at gmail dot com
PHP 5.3.1 (cli) (built: Nov 19 2009 10:17:43)

Different php version and platform. Same problem..
 [2012-02-26 08:12 UTC]
-Status: Feedback +Status: No Feedback
 [2012-02-26 08:12 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2012-05-16 13:31 UTC] plb at webfactory dot de
This bug still exists.
Can be reproduced with ne code snippet of the initial posting in the following 

- Mac OSX 10.6.8, PHP 5.3.12
- Ubuntu 10.04 (Lucid Lynx), PHP 5.3.5-1ubuntu7.7
 [2013-02-05 14:16 UTC] mp at webfactory dot de
Still a problem in 5.3.21.

Can someone please re-open this bug? I'd like to provide all the feedback you need 
 [2013-03-22 14:57 UTC]
-Status: No Feedback +Status: Verified
 [2013-03-22 14:57 UTC]
Replicated with original script in 5.5.0beta1
 [2014-04-03 10:30 UTC]
-Status: Verified +Status: Not a bug
 [2014-04-03 10:30 UTC]
I'm not convinced this actually is a bug.

STDERR is not necessarily related to the error_log. 

If INI's error_log is not set, then the SAPI module's log_message callback is executed. That's why you see errors in the VHost's error_log for an unconfigured error_log with log_errors=On.

Opening php://stderr just dup's STDERR_FILENO, which in the case of Apache httpd is redirected to the main error_log.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC