Page 1 of 1

problem running with xampp??

PostPosted: 13. December 2008 05:06
by haef
hello...

im a newbie...

i got problem when running my program on xampp

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\skripsiHasan\index.php:16) in C:\xampp\htdocs\skripsiHasan\olapCrosstab.php on line 2

but on wamp there is fine no warning ....why?


any body can help me please? i think there is problem with php.ini?

thx b4

Re: problem running with xampp??

PostPosted: 13. December 2008 06:06
by Sharley
I don't know anything about WAMP you would have to ask your question "why" at WAMP.



You have mixed php and html?

Your session php code goes before the html headers or else you will get this warning as the html headers have been sent first - for example:
Code: Select all
<html>
<head>
<title>Page title</title>
</head>

<body>

<?php
session_name ('name');
ini_set ('session.use_cookies', 0);
session_start();
?>



Change your code placement like this, and you should be fine.
Code: Select all
<?php
session_name ('name');
ini_set ('session.use_cookies', 0);
session_start();
?>

<html>
<head>
<title>Page title</title>
</head>

<body>

Also if you paste the code of your script here the troubleshooting can be more accurate, but I think you will get the idea...
...you have to make sure nothing gets sent to the browser before session_start();
Including white space.
http://www.php.net/manual/en/function.session-start.php

Re: problem running with xampp??

PostPosted: 19. September 2010 22:26
by FeralReason
I am running XAMPP on Windows XP (WAMP) and I repeatedly get these errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\test\test.php:1) in C:\xampp\test\test.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\test\test.php:1) in C:\xampp\test\test.php on line 2
Session value = 1

When I try to run a simple test file that contains nothing but this code:

<?php session_start(); ?>

Does anyone have a clue as to how this is being caused ?

Thanx !

Re: problem running with xampp??

PostPosted: 20. September 2010 05:04
by Altrea
Have you saved the file as UTF-8 with BOM (Byte Order Mark)?
The PHP Parser don't like BOMs so it sends the BOM directly to the browser.