in reply to Apache::Session::MySQL Help... Please

You need to debug. We can't really help you much if you don't post a small example of code that is failing. To find out where it's failing, either run it in the debugger or use print STDERR statements to log what's going on. Verify everything, i.e. does the cookie variable really get the cookie in it, does your database connection really connect, etc.

99% of all Apache::Session problems come from people either failing to connect to the database and not checking the return values from DBI->connect or not letting the tied session variable go out of scope. Check for those problems first.

  • Comment on Re: Apache::Session::MySQL Help... Please

Replies are listed 'Best First'.
Re: Apache::Session::MySQL Help... Please
by powerhouse (Friar) on Dec 28, 2002 at 19:27 UTC
    Yes, that database is connecting, and the cookie is being left. All the cookie holds is the session_id, I have MySQL hold everything else.

    I have the same problem, even when I disable cookies and the sites just passes the session_id from page to page.

    I have tracked it down to the following problems....


    Thank you,
    Richard.

    Edit by tye, change PRE to CODE tags, add READMORE

      I can't be sure without seeing the code for FRHWebDB::Session, but it looks to me like you have a scoping problem. You've made your session variable global, so it doesn't go out of scope until Perl shuts down. You should try making it lexically scoped (my) and let it go out of scope at the end of your CGI. Or you can do a quick fix by setting it to undef at the end.

      By the way, you don't need to explicitly exit at the end of a CGI, and it hurts portability to mod_perl, so leave that out.