php - Random Cannot send session cache limiter - headers already sent -
in server logs see there error
php warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent (output started @ /public_html/templates/meta.php:294) in /public_html/include/query.php on line 7
seems obvious got output started sooner...but
errors gets generated , can't reproduce maybe because `session_start()' inside of if statement.
this beginning of query.php
<?php // including here can check user logged in or not on each , everypage if(!isset($_session)) { //to make session work across multiple domains. session_set_cookie_params(0, '/', '.mydomain.com'); session_start(); }
everywhere query.php gets included before meta.php
meta.php html , js few php blocks , line 294 in middle of js function.
but intrigues me error request not involve these 2 files @ all.
for example
from access log
66.249.72.33 - - [19/aug/2013:22:44:30 +0100] "get /robots.txt http/1.1" 404 7592 "-" "mozilla/5.0 (compatible; googlebot/2.1; +http://www.google.com/bot.html)"
66.249.72.33 - - [19/aug/2013:22:44:30 +0100] "get /content_files/spikes%20protocol.pdf http/1.1" 200 215267 "-" "mozilla/5.0 (compatible; googlebot/2.1; +http://www.google.com/bot.html)"
and error log
[mon aug 19 22:44:30 2013] [error] [client 66.249.72.33:44269] ah01215: php warning: session_start() [function.session-start]: cannot send session cookie - headers sent (output started @ /public_html/templates/meta.php:294) in /public_html/include/query.php on line 7
[mon aug 19 22:44:30 2013] [error] [client 66.249.72.33:44269] ah01215: php warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent (output started @ /public_html/templates/meta.php:294) in /public_html/include/query.php on line 7
as can see @ 22:44:30 google bot made 2 requests 1st robots.txt , got 404 there no robots.txt 2nd pdf file
in both cases there not php code involved got php warnings these requests.
these no other access logs google bot before or after these.
general structure of code this
<?php if(isset($_get['url1'])){$url1 = $_get['url1'];}else {$url1 = "";} if(isset($_get['url2'])){$url2 = $_get['url2'];}else {$url2 = "";} require_once('include/query.php'); require_once('include/auth.php'); /* php code */ ?> <?php include 'templates/meta.php'; ?> //html
but error gets generated requests not use query.php or meta.php @ well, in given example.
typically, find "headers sent" errors whitespace errors. maybe check files shared between of these pages , see if there line break or space after closing ?>
tag. try avoid using closing php tags @ end of files since discarded parser anyway.
Comments
Post a Comment