note 56774 deleted from function.session-start by mazzanet
| From: | mazzanet@php.net | Date: | Thu, 15 Sep 2005 07:19:15 +0000 |
| Subject: | note 56774 deleted from function.session-start by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95200@lists.php.net to get a copy of this message | ||
Note Submitter: cmvondoom at hotmail dot com
----
hi ppl
I had a problem with sessions and headers not sent and spent some time knocking my head on the
computer trying to find the solution.
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started
at /home/canna/public_html/sites/default/settings.php:130) in
/home/canna/public_html/includes/session.inc on line 10
warning: Cannot modify header information - headers already sent by (output started at
/home/canna/public_html/sites/default/settings.php:130) in
/home/canna/public_html/includes/common.inc on line 99.
I think it's a common problem as i have seen many topics on the subject but none solved my
problem.
If you get this error put the code with the session_start() fucntion call in the beginning of the
web page code. even before any html tag. It solved my problem
example
<?php
session_id('123');
session_start();
if(!isset($_SESSION['nome']))
{
echo "<script> location='../index.php';</script>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<? echo $_SESSION['nome'];?>
</body>
</html>
I hope it helps you out ppl