Problem with session_start()
Posted: Sun Apr 04, 2010 5:54 pm
Hey,
I have following code:
Now when I open this in a webbrowser, I get following warnings:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/chroot/home/rond71/public_html/index.php:7) in /var/chroot/home/rond71/public_html/index.php on line 8
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/chroot/home/rond71/public_html/index.php:7) in /var/chroot/home/rond71/public_html/index.php on line 8
What's wrong?
I have following code:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<title>Codetest</title>
</head>
<body>
<?php
session_start();
require_once 'objecttest.php';
$o = new objecttest();
$_SESSION['object'] = $o;
?>
...
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/chroot/home/rond71/public_html/index.php:7) in /var/chroot/home/rond71/public_html/index.php on line 8
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/chroot/home/rond71/public_html/index.php:7) in /var/chroot/home/rond71/public_html/index.php on line 8
What's wrong?