Warning: session_start () [function. Session-start]: cannot send session cookie Solution

Source: Internet
Author: User

After a session is used for many times, the following prompt is displayed,

Warning: session_start () [function. session-start]: cannot send session cookie-headers already sent by (output started at/home/u114264/include/db_mysql tutorial. class. PHP Tutorial: 1) In/home/u114264/login1.php on line 3

Warning: session_start () [function. session-start]: cannot send session cache limiter-headers already sent (output started at/home/u114264/include/db_mysql.class.php: 1) In/home/u114264/login1.php O (www.111cn.net) N line 3

The biggest possible cause of the analysis is that there is a character output including spaces before session_start (), as long as it is processed,

There is another kind of from: http://www.111cn.net/phper/31/38824.htm?directly add @ session_start () to session_start. Not recommended

Address solution.


The most common solution. Enable output_buffering = 4096; Global attribute.

 

Solution 2.


Ob_start: Open the output buffer.
Function Format: void ob_start (void)
Note: When the buffer zone is activated, all non-file header information from the PHP program is not sent, but stored in the internal buffer zone. To output the buffer content, you can use ob_end_flush () or flush () to output the buffer content.

Note:


If you use UTF-8 encoding, be sure to remove the BOM in the UTF-8, this is because the UTF-8 encoding file contains the BOM, and PhP4, 5 are not supported Bom. Remove BOM and use Notepad ++ to open the conversion.

Warning: session_start () [function. Session-start]: cannot send session cookie Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.