1

I'm writing a page in PHP and having trouble with the session code. Here are my first lines of code:

<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<?php require '/home/fixit/Background/inc.inc'; ?>


<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>

The problem is, when I upload it I get this error:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/fixit/public_html/index.php:1) in /home/fixit/public_html/index.php on line 1

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/fixit/public_html/index.php:1) in /home/fixit/public_html/index.php on line 1

I've pulled the page source online and found that its putting in a small code prior to my session, just a simple <br />

I'm using Microsoft Expression Web (the first one) to code this out, any help would be very much appreciated. Thanks

Sam Spencer
  • 8,492
  • 12
  • 76
  • 133

1 Answers1

-1

The session_start() method must be called first. Because ira creating a cookie, and this isnt possible after any output. So look if there are any whitespaces, maybe after ?>... these all cann provocate this error...

T_01
  • 1,256
  • 3
  • 16
  • 35