|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34744 system() forces Content-type header output
Submitted: 2005-10-05 20:53 UTC Modified: 2005-10-06 02:21 UTC
From: clewis at myfonts dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.0.5 OS: Windows XP, CentOS 4
Private report: No CVE-ID: None
 [2005-10-05 20:53 UTC] clewis at myfonts dot com
Calling the system() function forces the standard Content-type: text/html header output, even when output buffering is on.  This behaviour is unlike other output commands such as print, which suppress the "automatic" headers until the output buffer is flushed.

Note that replacing system() with print() in the sample code works as expected.

Reproduce code:




header("Content-type: text/plain");
print "Hello  World.";


Expected result:
Content-type: text/plain

Hello World.

Actual result:
Content-type: text/html

Warning: Cannot modify header information - headers already sent...
Hello World.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-05 21:37 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2005-10-05 22:06 UTC] clewis at myfonts dot com
I'm using Apache 2 APXS module on both Windows XP SP2 and CentOS 4.1 (like RHEL 4), if that helps.
 [2005-10-05 23:07 UTC]
RTFM: "The system() call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a server module."

 [2005-10-06 02:21 UTC] clewis at myfonts dot com
christian dot mueller at dfpx dot de says:
I read "web server's OB" ... that is quite different from the "php OB initiated with ob_start()" as reported in this Bug. 

I (original submitter) say:

It looks like I should be using passthru() instead of system().  Nonetheless it is confusing that system() completely ignores the PHP output buffer.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Jun 07 15:03:42 2023 UTC