Breaking News
Home / Web / PHP / PHP Issues / PHP Warning : Cannot send session cache limiter – headers already sent

PHP Warning : Cannot send session cache limiter – headers already sent

Issue

The PHP script script gives an error the following error

1) [[25-Dec-2011 01:16:21] PHP Warning:  session_start() [<a href=’function.session-start’>function.session-start</a>]: Cannot send session cache limiter – headers already sent (output started at /Users/mvohra/workspace/infuzee/projects/webservices/common/subscriptions/edit-upload.php:24)

in /Users/mvohra/workspace/infuzee/projects/webservices/admin/header.php on line 2

2) [25-Dec-2011 01:17:14] PHP Notice:  A session had already been started – ignoring session_start() in /Users/mvohra/work

Solution

In the first issue looks like some data/html or headers are getting flushed to the browser by the script and then the session_start() method is getting called. It important to understand session_start() should be invoked before any data/header is returned to the client browser.

In the second issue session_start() is getting called again from the header.php file and the session has already started by some previous call to session_start() in some other php file. This is a warning message so may not cause a problem, but this warning can be avoided by making sure that session_start() is called once and that too before any data/header being returned to avoid the first issue as mentioned above.<!>[pb_builder]

Check Also

Warning: mysql_connect(): [2002] No such file or directory

Issue Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in …

Advertisment ad adsense adlogger