Welcome Guest, Not a member yet? Register   Sign In
Session and headers sent problems :(

I'm trying to get my new version of my site to work, but I'm running into problems with headers and session. This probably has something to do with me being on a shared host because I never have these problems on my test computer.

I made my own session wrapper library, it's very simple and when I run the init() function to start the session, it triggers the "headers already sen" error. I'm not sure how to get my session to run before the server sends it's headers. Any help is appreciated, thanks

    *    Check if session has been started and if header have been sent
    private function init()
        if (! isset($_SESSION))
            if (headers_sent())
                trigger_error ('Session was not started before headers sent');

[eluser]Michael Wales[/eluser]
Make sure there isn't any whitespace being sent prior to the session_start() function (spaces at the top/bottom of files that are previously loaded).

I actually ran into that header problem as well, thanks Whales Smile. Well it took about three and a half hours to get it all working, but it's finally up and running in Codeigniter Smile For the session problem I fixed it by placing ob_start() at the top of all my front controller files (I have two), and an ob_end_flush() at the end. God, what a nightmare and this was with a couple of hours of prep on top of it...

Same problem here, solved in chobo's way. Thanks

Theme © iAndrew 2016 - Forum software by © MyBB