Re: Session troubles
| From: | Sean LeBlanc | Date: | Wed, 02 Jan 2002 02:32:03 +0000 |
| Subject: | Re: Session troubles | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79196@lists.php.net to get a copy of this message | ||
On 12-31 09:23, Jaime Bozza wrote:
> Sean,
> From your php error_log, it's saying the following:
> Failed to write session data (user)
>
> which sounds like it's having problems writing to the user-defined
> session handler. Are you using a user-defined session handler? If not,
> make sure your php.ini file has:
>
> session.save_handler = files
>
> And *NOT*:
> session.save_handler = user
>
> That will make a big difference.
Good eye. That was it. I *did* have it as "user" because I was trying to do
my own user-defined session handler, and then stepped back and was just
trying to get the simpler case to work, w/o changing it back.
Thanks, it works now!
Now, I just need to see if I can get my session_handler working...
It's too bad the error message isn't more descriptive for this, BTW...
> -----Original Message-----
> From: Sean LeBlanc [mailto:seanleblanc@attbi.com]
> Sent: Saturday, December 29, 2001 1:21 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Session troubles
>
>
> On 12-29 12:56, David Jackson wrote:
> > Sean --
> > Don't know if this help but here's what I just worked for me. What
> > ver. of PHP are you using? It seem to me that 3.x.x needs
> > PHPLIB: http://sourceforge.net/projects/phplib
> > to handle sessions? -- David Jackson
> >
> > --- sean.php -------
> > <?php include("seaninc.php"); ?>
> >
> > --- seaninc.php ------
> > <?php
> > session_start();
> > session_register("i");
> > $i++;
> > echo $i;
> > ?>
>
> I'm using 4.0.6. I believe session handling was added as part of
> standard 4.x, right (if configured to compile it)?
>
> Some more info: I tried with Konqueror, as I know a cookie needs to be
> sent during the session_start() phase - I did get a dialog pop-up asking
> if I wanted to accept the cookie, but I still got the error:
>
> Fatal error: Failed to initialize session module in
> /usr/local/apache/htdocs/sesstest.php on line 2
>
> It says line 2 because I deleted some white space and commented out code
> thas was before session_start().
>
> I set logging errors on, and sent it to syslog. Here's what it says: Dec
> 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize session
> module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec 29
> 12:12:57 free httpd: PHP Warning: Failed to write session data (user).
> Please verify that the current setting of session.save_path is correct
> (/tmp) in Unknown on line 0
>
> But /tmp exists, and is world writeable:
>
> free# ls -ld /tmp
> drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp
>
> > > On 12-29 09:59, Miles Thompson wrote:
> > >> Sean,
> > >>
> > >> What's going on in incl.php. Are you issuing a session_start()?
> > >
> > > No, I was not.
> > >
> > >> What if it's rearranged like so, as I understand you have to
> > >> register the session variable before using it.
> > >>
> > >> include("incl.php");
> > >> session_start();
> > >> session_register("mine");
> > >> $mine++;
> > >> echo $mine;
> > >
> > > No dice, either. Actually, I had tried several permutations of the
> > > order before posting. :)
> > >
> > >>
> > >> There's the divide and conquer approach too. What do you see if
> > >> you comment out the include, then issue a phpinfo() and a die()?
> > >
> > > Okay, I tried commenting out include, resulting in this code:
> > >
> > > session_start();
> > > session_register("i");
> > > $i++;
> > > echo $i;
> > >
> > > When I run the above, I get this:
> > > Fatal error: Failed to initialize session module in
> > > /usr/local/apache/htdocs/sesstest.php on line 6
> > >
> > > Which is getting somewhere, in a way. Line 6 is session_start();
> > >
> > > What part from phpinfo() output were you interested in? Or did you
> > > want to see all of it?
> > >
> > > Thanks for the help.
> > >
> > >>
> > >> HTH and Merry Christmas / Happy New Year - Miles Thompson
> > >>
> > >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote:
> > >> > I asked this on php-install list, but got no response so here
> > >> > goes...
> > >> >
> > >> > I simply cannot get session to work correctly. Here's the test
> > >> > script:
> > >> >
> > >> > include("incl.php");
> > >> > session_start();
> > >> > $mine++;
> > >> > session_register("mine");
> > >> > echo $mine;
> > >> >
> > >> > incl.php includes code to save/retrieve session information
> > >> > to/from DB. It calles session_set_save_handler at the end.
> > >> >
> > >> > What happens is I get an error because it is trying to read the
> > >> > variable out and I get a DB error, but my session writing routine
>
> > >> > is never called...I know, because I have a print in there. And of
>
> > >> > course, the var doesn't increment upon refreshes - it remains 1.
> > >> >
> > >> > I've seen this before, and it was fixed, but I forget how it was
> > >> > done, as I didn't actually implement the solution (I hear and I
> > >> > forget, I do and I remember, I guess). About my system:
> > >> >
> > >> > FreeBSD 4.4
> > >> > Apache 1.3.20
> > >> > PHP 4.0.6
> > >> >
> > >> > Any and all help appreciated.
> > >
> > > --
> > > Sean LeBlanc:seanleblanc@attbi.com Yahoo:seanleblancathome
> > > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome
> > > One learns to itch where one can scratch.
> > > -Ernest Bramah
> > > Management QOTD:Get hopping on the domain expertise!!
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
> > > php-list-admin@lists.php.net
> >
> >
> > --
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
> --
> Sean LeBlanc:seanleblanc@attbi.com Yahoo:seanleblancathome
> ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome
> In most countries selling harmful things like drugs is punishable. Then
> howcome people can sell Microsoft software and go unpunished?
> -Hasse Skrifvars
> Management QOTD:Work out a solution that fits with problem management!!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net To
> contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Sean LeBlanc:seanleblanc@attbi.com Yahoo:seanleblancathome
ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome
They can't stop us... we're on a mission from God!
-The Blues Brothers
Management QOTD:It's wrong headed not to articulate the mission and values
and eliminate redundancies in the meta-data.