Page 1 of 1

Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 07:06
by alicemcline
hi i am getting following error in PHP using Xampp; i searched whole net and found out that i have made file correctly but, it just doesn't seem to work.. :(

Code: Select all
<?php session_start(); ?>
<html>
.
.
.
.
</html>


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Documents and Settings\*******\Desktop\xampp-win32-1.6.8\xampp\htdocs\login.php:1) in C:\Documents and Settings\*******\Desktop\xampp-win32-1.6.8\xampp\htdocs\login.php on line 1

please somebody help..

btw, sorry for posting this into this forum if its wrong place .. (rest of the forums were not in english and i think its problem regarding PHP in Xampp..)

Re: Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 07:21
by Wiedmann
I guess your file is utf-8 encoded?

Re: Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 08:36
by alicemcline
yup following line exists after <html><head> tags..
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Re: Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 08:59
by Wiedmann
Store your file as utf-8 without BOM.

Re: Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 10:49
by alicemcline
stored but, still not working..

my friend told me that it might work if i editted php.ini and made following changes

; Initialize session on request startup.
session.auto_start = 1

but, even after restarting xampp, it didn't work

Re: Strange behaviour of PHP in Xampp

PostPosted: 10. July 2009 15:16
by Wiedmann
Well, if "<?php session_start(); ?>" is the (very) first line in your code, and the file have no BOM, this must work (without changing anything.

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 00:10
by roman2
And it starts at very beginning of the line (no spaces in front).

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 13:36
by alicemcline
there aren't any spaces before session_start() and when i uploaded same file onto my linux apache server and it shows no errors at all whereas in xampp it is showing following error..

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by .. on line 1 :(

please help

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 13:51
by Wiedmann
upload your file to rapidshare (or similar), so we can see the original file you are using.

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 14:24
by alicemcline
Wiedmann, i have sent you pm with link to uploaded file..

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 14:32
by Wiedmann
here's link to uploaded file

Well, this file "login.php" still have a BOM.

You remember:
Wiedamann wrote:Store your file as utf-8 without BOM.

Re: Strange behaviour of PHP in Xampp

PostPosted: 14. July 2009 14:42
by alicemcline
ok thanks it worked..
now i wonder how to configure Dreamweaver to stop saving with Byte-order Mark.. :?