When configuring a PHP website, the following error occurs frequently on the header: Warning: session_start () [function. Session-start]: cannot send session cache limiter, which does not affect page opening.
Warning: session_start () [function. session-start]: cannot send session cache limiter-headers already sent (output started at D: \ orther object \ phptest \ Session. PHP: 1) In D: \ orther object \ phptest \ Session. PHP on line 2
1. if dreamwever is used and UTF-8 encoding is used, right-click a page and choose "Page property"> "title/encoding" to view a "including Unicode signature (BOM) (s) "check box, cancel it. This is because of the BOM contained in the UTF-8 encoded file, while PhP4 and 5 do not support Bom.
2. Modify session. auto_start = 0 in PHP. ini to session. auto_start = 1.
3. There is another way to add @ session_start () to session_start.
4. This information indicates that when the session is enabled, there is already content output. You can add ob_start () at the top ().
Ob is short for output buffering. Ob is correct and can speed up the webpage. However, adding ob functions blindly only increases the CPU burden. The basic role of OB.
1). Prevent the use of setcookie or header, session_start function errors after the browser outputs.
2 ). capture the output of some unrecoverable functions. For example, phpinfo will output a lot of HTML, but we cannot use a variable such as $ info = phpinfo (); to capture, at this time, OB will work.
3). process the output content, such as gzip compression, simple conversion, and replacement of some strings.
4) generating static files is actually capturing the output of the entire page and saving it as a file, which is often used in generating HTML or the whole page cache.
5. Add the following code to the PHP file header to block the warning error:
PHP code
<? PHP
// Put session_star () after session_star ()
Error_reporting (e_error );
Ini_set ("display_errors", "off ");
// Your PHP code
?>
Warning: session_start () [function. Session-start]: cannot send session cookie-headers already sent