PHP session start “Cannot send session cookie and cache limiter”

前端 未结 3 1881
野的像风
野的像风 2021-01-14 03:10

I\'ve changed my hosting server from a Windows to a Linux system. But when I run my PHP program, I get this errors:

Warning: session_start() [function.sessio         


        
相关标签:
3条回答
  • 2021-01-14 03:24

    i think you should add

    ob_start();

    in the first of your code

    and in the bottom add

    ob_get_contents(); ob_end_flush();

    because of

    session send headers to server , also you added echo ( this also tell server its html with headers )

    server now has to headers so use the ob_start(); and ob_end_flush(); to work :)

    0 讨论(0)
  • 2021-01-14 03:29

    You get the error because there are some output before you have initiated session_start(); This could be caused because of your editor that include a BOM character in the beginning of your file. Try open the code in notepad and see if there are any lines before session_start(), (spaces) or things like that and remove them.

    To fix your editor if it add a bom in your file, you need to go to your settings and turn it off.

    0 讨论(0)
  • 2021-01-14 03:50

    You have a leading BOM, new line or other whitespace character before the opening <?php tag.

    The errors talk about line 2 and line 4, but in the actual code above session_start() is called on line 3. Therefore, leading whitespace is the problem...

    0 讨论(0)
提交回复
热议问题