Cannot modify header information - headers already sent
Problem:
This error shows up:
"Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxxxx/phpshop/etc/phpshop.cfg) in /home/xxxxxxxx/phpshop/modules/admin/lib/ps_session.inc on line 26"
or this error:
"Warning: Cannot send session cookie - headers already sent by (output started at /home/xxxxxxxx/phpshop/etc/phpshop.cfg) in /home/xxxxxxxx/phpshop/modules/admin/lib/ps_session.inc on line 22"
Solution:
Either you can track down and edit all of your files based on the file name and line number in the error code to make sure there is no whitespace at the end of final tags or you can buffer your output which will wait until the headers are sent before sending content (much easier method).
Easier solution:
The easiest way to buffer your output is change first line of index.php to:
and change last line of index.php to:
Note: There was also a contribution that stated that, if your version of PHP is 4.0.4 or above, the first line of index.php could be changed to:
<?php ob_start("ob_gzhandler");
and that the last line did not need to be changed.
Reason:
Technically, this is a PHP problem, not a PhpShop problem. PHP is a little picky about the way it sends output. Cookies and session information must be sent before any other characters and "any other characters" includes whitespace (spaces, tabs, carriage returns, line feeds, non-displayable characters, etc). You may not see whitespace at the end of files but PHP does. If any of those characters get sent, the PHP interpreter assumes you don't want to send any more header information. Then, when you do send header information, PHP reports this error.
That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.