php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54452 Documentation does not mention that header() will not work in PHP CLI mode.
Submitted: 2011-04-02 14:25 UTC Modified: 2011-07-02 03:40 UTC
From: busbyjon at gmail dot com Assigned: frozenfire (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.6 OS: OS X 10.6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: busbyjon at gmail dot com
New email:
PHP Version: OS:

 

 [2011-04-02 14:25 UTC] busbyjon at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.header#Notes
---

headers (and headers_list() and headers_sent()) will NOT work using the php command line as this has been moved into the php-cgi binary.

This is detailed in an earlier bug report, but not mentioned at all on these documentation pages.



Test script:
---------------
<?php
ob_start();
setcookie("TestCookie","SomeValue");
header("X-Sample-Test: foo");
header('Content-type: text/plain');
?>

<html>
<body>

<?php
// What headers are to be sent?
var_dump(headers_list());
?>

</body>
</html>

<?php ob_end_flush();?>



Expected result:
----------------
<html>
<body>

array(0) {
<< headers here >>
}

</body>
</html>


Actual result:
--------------
<html>
<body>

array(0) {
}

</body>
</html>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-02 03:40 UTC] frozenfire@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: frozenfire
 [2011-07-02 03:40 UTC] frozenfire@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 06:00:01 2026 UTC