Jump to content

session_start() causing an infinite loop


Msam85

Recommended Posts

 

Hi everyone, I'm new in this forum and I have a problem that can´t resolve.

 

About two months ago I installed Xampp package (PHP 5.3, Apache 2.2) on a Windows xp server. I had a php web from about 4 or 5 years, so many errors/warnings I had resolve in order to use the new PHP version.

 

3 or 4 weeks ago, I noticed a problem with an "infinite loop" when calling to session_start() in one of my pages an I noticed a notify icon informing me a "damaged file" and It was refered at the PHP temp folder (where PHP stores the sessions). So I opened php.ini and changed the folder to another created by me.

Everything went apparently ok but yersterday the infinite loop appeared again. In this time, that windows icon doesnt appear, so I had to stop the server, deleting all the sessions files and everything was ok (storing sessions, destroying it...).

When faults,the pages with no use of sessions works ok

 

I suppose the problem is at the I/O manage of PHP (maybe does not close the sessions file(s) correctly) and when It tries to open again, causes a "infinite loop", maybe because sessions are not closed correctly (users do not click on "log out" for example).

 

The problem is that I can't reproduce the error to test anything. In order to reproduce it, I tried to open the session file that my aplication creates in exclusive mode, with :

 flock($fp, LOCK_EX) 

but the pages load correctly and sessions are stored.

 

Anyone knows what is happening?

Maybe creating a script which calls to session_destroy() when the problem appears,could "solve" this?

Any configuration recomended on the php.ini in order to reduce the probability of this?

 

Thank you in advance and sorry for my english :)

Link to comment
https://forums.phpfreaks.com/topic/198873-session_start-causing-an-infinite-loop/
Share on other sites

Hm, it could be that your api is generating sessions which have a giant expiration delay and your session folder gets full before any of them get destroyed... your api must be changed so when the session starts you define a finite expiration date like 7 days  that would solve your problem.

 

SOMETHING LIKE session_cache_expire

 

or session_cache_limiter see on pp help for more info

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.