Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

session_start() after class include outputs error??

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

session_start() after class include outputs error??

Postby McMurphy- » Mon May 05, 2003 3:47 am

Hi ppl,

I'm registering an object as a session variable. I've read that the class definition needs to be appear before the session_start() but when I do that I keep getting:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at


This line disappears if I put the session_start right after the <?php at the beginning of the document but since I have to include the class beofre it I can't think of a solution.

Thanks in advance for any help,

Cheers,

McMurphy
McMurphy-
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Apr 02, 2003 11:15 pm

Postby pootergeist » Mon May 05, 2003 6:33 am

got any line breaks in either the class file or the few lines above session_start ?

any line break (empty line) is effectively sent to the browser which effects sending a header.
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Postby McMurphy- » Mon May 05, 2003 8:49 am

10x a lot! I had a line break in the class include file and now its ok.

Cheers,

McMurphy
McMurphy-
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Apr 02, 2003 11:15 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron