Warning: session_start () [function. session-start]: Cannot se

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 on 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 way to 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.

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.