Forum Moderators: coopster

Message Too Old, No Replies

session start() causing an infinite loop

Getting an *aparently* infinite loop when calling session_start()

         

Msam85

8:31 am on Apr 17, 2010 (gmt 0)

10+ Year Member



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 I 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 something.
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 :)

Matthew1980

6:54 pm on Apr 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Msam85,

Welcome to the forum :)

By infinite loop, what do you actually mean? Does the screen go blank, does it take longer than normal for the page to load?

Also I would not recommend changing dir structures within php, you could be harming the system as there maybe other calls to the location elsewhere unbeknown to you.

When you refer to a windows Icon, what is it, I have never encountered this before, I run wampserver which is the same sort of thing, I think the difference is that XAMPP is for use on linux, but there are windows exe versions, I used that on a previous laptop. I digress.

Use session_destroy() when you are logging a user out, unset() does exactly the same thing too :)

Cheers,
MRb