Page 1 of 1

Problem with XAMPP

PostPosted: 11. December 2005 03:03
by krazframe
Hey, fist let me say XAMPP is a great idea! Makes installing a server much easier.
I recently got a new server and needed to transfer my website over. So I downloaded and installed XAMPP because I liked the idea of an all in one package.
After I tranfered my MYSQL and http/php files I ran the server
My pages are displayed, but on my main page, where I have a blogg, I am reciving this error right where I include the blog php


//

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\apache\xampp\htdocs\index.html:8) in C:\Program Files\apache\xampp\htdocs\index.php on line 28

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\apache\xampp\htdocs\index.html:8) in C:\Program Files\apache\xampp\htdocs\index.php on line 28

//

I never had this problem on my old server, which was apache 2, with php 5.05

My main page is an index.html with the blogg, index.php, included in it.

Does anybody have any idea as to why this is happening?

more info

PostPosted: 11. December 2005 11:11
by krazframe
Well, I've been playing around with it a bit and found sompthing rather peculiar,

if i make an html file with the code

/////////////////////////////////////////////
<?php include("index.php"); php?>
/////////////////////////////////////////////

I don't get the error. ( that is not including the /'s)
If I make an html file with the code

/////////////////////////////////////////////

<?php include("index.php"); php?>
/////////////////////////////////////////////

I do get the error. Notice the space before the php
And if I make a file with the code

/////////////////////////////////////////////
<html><?php include("index.php"); php?>
/////////////////////////////////////////////

I get the error. It looks like every time I put anything before index.php I get an error. Anybody know whats going on?

PostPosted: 11. December 2005 21:42
by cj_nza
If your blog uses cookie bases sessions - this is expected PHP behaviour.

You cannot send browser output and afterward try to modify the header (cookie session data).

Hence your error informing you of this.

You should not send any data to the browser prior to calling the session_start function.

See the session_start function on php.net

PostPosted: 13. December 2005 13:18
by Wiedmann
I get the error. It looks like every time I put anything before index.php I get an error. Anybody know whats going on?

That's the desired behaviour. See the PHP-manual about sessions.

Alternatively

PostPosted: 05. January 2006 01:16
by eXcalibur_lk
You could wrap your include in ob_start() and ob_end_flush() also, this will execute all php code within the two functions before it outputs any html.

Read the PHP Manual for more details.