Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

The other day i kept getting this error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/a-header.php:10) in /var/www/header.php on line 26


so to fix it I moved the session_start() function from line 26 to line 1 on my header.php file.

That fixed it.

I am posting here just incase anyone else is getting it..

If you have benefited from this post, wallpaperama would appreciate a link back to wallpaperama.com - Thanks


Description
bool session_start ( void )

Notes
Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

so what does this all mean really.

ok, i will try to explain more simple.

lets say i have a script that looks like this:

<?php
echo 'hello wallpaperama';
session_start();
?>