php.net |  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
Votes:10
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
 [2010-03-15 22:24 UTC] houdelou at hotmail dot com
Description:
------------
PHP 5.2.6-3ubuntu4.5 with Suhosin-Patch 0.9.6.2 (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"); 
fclose($log);

/* 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-19 14:42 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2010-05-19 14:42 UTC] mike@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [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] stas@php.net
-Status: Feedback +Status: No Feedback
 [2012-02-26 08:12 UTC] stas@php.net
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 
environments:

- 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] arpad@php.net
-Status: No Feedback +Status: Verified
 [2013-03-22 14:57 UTC] arpad@php.net
Replicated with original script in 5.5.0beta1
 [2014-04-03 10:30 UTC] mike@php.net
-Status: Verified +Status: Not a bug
 [2014-04-03 10:30 UTC] mike@php.net
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-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 15:01:23 2019 UTC