Very slow session_destory()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dinger
Forum Newbie
Posts: 2
Joined: Fri May 16, 2008 5:08 am

Very slow session_destory()

Post by dinger »

Hello all,

I'm having real trouble figuring out why a call to session_destory() is taking 50 seconds.

It's a file called cron.php in Moodle.

This only happens with our live server... Our test servers do not have this problem.

Please help!

Rob
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Very slow session_destory()

Post by Jade »

Maybe you should check your session settings in the php.ini file? Could be a difference there is causing the problem.
dinger
Forum Newbie
Posts: 2
Joined: Fri May 16, 2008 5:08 am

Re: Very slow session_destory()

Post by dinger »

The php ini files are unmodified.

This call actually causes apache to hang for the duration of the call... which obviously has an impact on our site.

Rob
Glycerine
Forum Commoner
Posts: 39
Joined: Wed May 07, 2008 2:11 pm

Re: Very slow session_destory()

Post by Glycerine »

the first user contribution on here may help? It loops through the user sessions and clears them... would that help

http://uk.php.net/manual/en/function.session-unset.php
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Very slow session_destory()

Post by Jade »

The only other thing I can think of is that you have an unusually large amount of data in each session. I would suggest loading a session and printing out everything that's in one. If it has any unnecessary data then make sure you remove it.
Glycerine
Forum Commoner
Posts: 39
Joined: Wed May 07, 2008 2:11 pm

Re: Very slow session_destory()

Post by Glycerine »

Why dont you store data in a mysql table create a random session key generated by user details such as IP and host etc... then save ALL there details to the database - EASY and fast...
Post Reply