Welcome Guest, Not a member yet? Register   Sign In
Pear and Session Header Problem
#1

[eluser]adamfairholm[/eluser]
Hey there,

This has really stumped me, mainly because its a little out of my area of knowledge with code igniter (and headers). I have integrated PEAR with CI (following the wiki guide) and for some reason I get this error message on all my pages:

A PHP Error was encountered

Code:
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /(path to CI)/system/application/hooks/pear_hook.php:15)

Filename: libraries/Db_session.php

Line Number: 248

I am familiar with the role of headers, but what I can't understand is why Db_session is trying to send headers here - I don't call it anywhere on the site, and use Freak Auth. I also have the Zend Framework installed. Funny thing is, they were all integrated with guides from 4webby, so that leads me to believe it is a problem with my stuff.

Is there anything I could be doing in my code that would be conflicting with PEAR in this way or causing a problem with the Db_session library? Here is the section of code that line 248 hangs out in:

Code:
/**
     * Write the session cookie
     *
     * @access    public
     * @param    boolean true if we want to send cookie even if a cookie has already been sent
     * @return    void
     */
    function sess_send_cookie($force = FALSE)
    {    
        if ( !$force && $this->cookie_sent )    return;
        log_message('debug','sending session cookie');
        setcookie(
                    $this->sess_cookie,
                    $this->userdata['session_id'],
                    $this->sess_length + $this->now,
                    $this->object->config->item('cookie_path'),
                    $this->object->config->item('cookie_domain'),
                    0
                );
        $this->cookie_sent = TRUE;
    }
    // END sess_send_cookie()


Any guidance would be greatly appreciated!
#2

[eluser]adamfairholm[/eluser]
Note to self: take a long deep break and THINK before posting to Code Igniter forum.

I remembered that header problems can often times be caused by spaces after the ?> php tag. Sure enough, the PEAR hook had a space and that was tripping it up.

Hopefully this is somewhat useful to someone who runs into the same problem...

...right...
#3

[eluser]pgsjoe[/eluser]
Wow, just saved me a headache by looking at two posts. It really is the space after the ?> that was preventing mine from working. I was always wondering why the 'redirect' function never worked, now I know. This helped tremendously!




Theme © iAndrew 2016 - Forum software by © MyBB