note 101377 deleted from function.headers-sent by danbrown
| From: | danbrown@php.net | Date: | Mon, 13 Dec 2010 16:31:19 +0000 |
| Subject: | note 101377 deleted from function.headers-sent by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174880@lists.php.net to get a copy of this message | ||
Note Submitter: asc
----
headers_sent() always returns true if a script is called with php-cgi and -q on command line.
test.php:
<?php
var_dump(headers_sent());
?>
> /usr/bin/php-cgi test.php
X-Powered-By: PHP
Content-type: text/html
bool(false)
> /usr/bin/php-cgi -q test.php
bool(true)
This seems to have impact on session handling as well:
session.php:
<?php
session_start();
?>
> /usr/bin/php-cgi -q session.php
<b>Warning</b>: session_start() [<a
href='function.session-start'>function.session-start</a>]: Cannot send session
cookie - headers already sent in <b>/kunden/265705_48145/test/session.php</b> on line
<b>1</b><br />
However, with php-cli headers_sent() works as expected.
Tested with php 5.2.11.