开发者

Session_start warning in PHP

开发者 https://www.devze.com 2023-03-11 22:09 出处:网络
That\'s the message i\'m receiving: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/new/login.php:1) in /var/ww

That's the message i'm receiving:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/new/login.php:1) in /var/www/new/login.php on line 3

And that's the exactly code开发者_高级运维:

<?php
if(!isset($_SESSION))
    session_start();
ob_start();

No spaces before, no nothing. What's wrong here?


Are you sure your file is not saved in UTF-8 with BOM? Try saving UTF-8 without BOM.


Check that you have no BOM unicode set in your file, it's a common error of this type. If no BOM is there, have you any auto included file via htaccess or phpini php_auto_prepend ?


check your php configuration for session.auto_start, if this is enabled, you have already an open session.

alternatively try this:

if (empty(session_id())) {
    session_start(); // if no active session we start a new one
}
0

精彩评论

暂无评论...
验证码 换一张
取 消