It's better when it's simple

User Tools

Site Tools


Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community

Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy


Cannot send session cookie

:?: I edited the config file and now I'm getting errors like this

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/codecrai/public_html/wiki/conf/dokuwiki.php:81) in /home/codecrai/public_html/wiki/inc/common.php on line 22

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/codecrai/public_html/wiki/conf/dokuwiki.php:81) in /home/codecrai/public_html/wiki/inc/common.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at /home/codecrai/public_html/wiki/conf/dokuwiki.php:81) in /home/codecrai/public_html/wiki/doku.php on line 123

:!: This happens when your editor adds a newline after the closing ?> php tag. This starts the output and PHP can't send cookies and other headers anymore. To fix it simply remove the newline or the whole closing tag. Also make sure you have no leading whitespace before the starting <?php tag.

:!: A similar problem can occur when non-ASCII is used in the config file and your editor saves the file in UTF-8 using a Byte Order Mark. Certain Windows software (eg. Notepad) is known to do this. The solution is to save the file using software which doesn't save this mark or allows you to omit it. The freeware program Notepad2 does this correctly when using EncodingUTF-8.

Encoding Setting in Notepad2

:!: This error is also displayed when another error occurs first and PHP starts the output by printing the error message. If you get any other error before the “cannot send session cookie” message, you need to fix that one first.

:!: About the closing tag, we should be aware of this recommendation.

The findbadphp.php script might help finding the problematic file.

faq/sessioncookie.txt · Last modified: 2012-11-28 12:31 by ach