Php prompts "Cannot send session cache limiter

Source: Internet
Author: User


When you run the PHP page, the following error occurs: "Cannot send session cache limiter-headers already sent by ()" or "function session_start ()", which is a headache. This is not the first time. To help you better understand the problem, write down the cause analysis and solution in detail and share it with you.

Problem analysis:

I remember that when I first encountered this problem, Google had a lot of answers and many solutions, but most of the root causes of this problem were: when running session_start (); there is no output, and the page has been empty line, or can be said that the page is a UTF-8 page containing DOM encoding.

Check whether the page contains DOM encoding methods:

1. Use the Dreamweaver software to open the page, view the page attributes (modify-page attributes-title/encoding), and check whether the "include Unicode signature BOM" item is checked;

2, notepad open, save as, the encoding format for ANSI does not contain DOM, if the UTF-8, basic certainly contain.

Solution:

Remove the DOM line by using tools such as editplus and ultraedit. The specific steps are as follows:

 

Step: open the page through UE-file-save as-format select UTF-8 without BOM-save, that is, the UTF-8 page goes to the BOM header, no blank lines of the page header will appear.
As shown in the following figure:
 

 

 


Other solutions:

1. Add ob_start () to the page header; // occasionally, it becomes invalid;
2, new page, COPY the code in the past, this method sometimes works, pay attention to GBK or UTF-8 encoding (usually by GBK as UTF-8 encoding will default with DOM encoding );
3. In another case, the server PHP configuration problem: modify session. auto_start = 0 in php. ini to session. auto_start = 1;
4. Basically, this problem can be solved. There are still some unconventional methods that are rare. If they cannot be solved, you can only Google.

Related Article

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.