Doctype In The Head Of The Page Causes Session_problem
i had this error in my site: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rentedco/public_h
Solution 1:
Yeah, putting the doctype out there pushes data onto the PHP output buffer, but the session_start() requires writing cookie data to the header. The doctype is part of the HTML page, and not the header, so it should be safe to put it in after the session_start().
Solution 2:
session_start() should always be written at the beginning or else it will not work same as header() function.
Solution 3:
Session start has to be called before any output gets sent to the browser change your code to
<?php session_start(); ?><!DOCTYPE html><?phpecho"fsdf";
Solution 4:
Try this idea. You can start and stop the php interpreter as many times as you like, but session_start() must happen before your start sending any html to the browser.
<?php
session_start();
?><!DOCTYPE html><html><head>
....
....
</head><body><?phpecho'fsdf';
?></body></html>
Post a Comment for "Doctype In The Head Of The Page Causes Session_problem"