We help IT Professionals succeed at work.

PHP pages take 5 minutes to load sometimes that use sessions

Dear Experts,

I am really hoping someone will have some insight into this.

What I am experiencing seems only to occur in firefox and safari. I have not tested Opera but have tested IE and Chrome which I have never been able to replicate the issue.

What is happening is on a page that uses sessions (PHPSESSID) to identify a user either someone who is logged in or just someone adding an item to a shopping cart, when they click on a page using Session information the page is so slow to load that it can take 5 minutes to load. The page does eventually load correctly and the session data is still in tack (not removed or deleted). Now the strange thing is while this slow loading page is occurring if I then click on another page that does not use SESSION information the page loads quickly and correctly but if I then click on a different page that does use SESSION information the same slow loading/hanging occurs and will continue to occur on all pages I try to load that use session information until the 5 minute hanging is over.

Now to make things stranger this does not happen all the time, only occasional and not on the same pages, but it only occurs on pages that use SESSION information and only occurs in firefox and safari which seems strange to me as Sessions are server side with the exception of the PHPSESSID cookie which does remains in tack during this slow loading/hanging pages.

I have been in contact with my host and asked them to test it. They have not been able to replicate it and there are no warning or alerts in the logs. I have also had other people test it, it happens very rarely but seems to be increasing in frequency.

I have two main questions. 1) does anyone have any ideas as to why this would occur and why it seems to be browser specific. Could html validation make any difference? My pages are running under DTD XHTML 1.0 Strict which I will need to change to Transitional to validate. I did test this thinking it could be the answer and was hopeful. When I validated a page this problem was occurring on I though I had solved it  but eventually the hanging did occur. But I have not given up hope that validating would help. What else could cause this strange thing?

Question 2) is the any tool that could test what is happening when this occurs. Could firebug give me some clue and if so what part. Is there any other browser tool or software that can help me analyse this when it occurs? I use a Mac.

Many thanks as always for your help


Comment
Watch Question

CERTIFIED EXPERT
Commented:
Hello
My answer is the same for both questions.
Check firebug in firefox in the tab network . That should show you what leaves the page on slow mode. A question though. Do you see that strange behaviour when you test these pages on the server?  (meaning the computers is both client/server)
Does this happening with another computer? (and same versions of browsers)
please feedback

Author

Commented:
Dear stergium,

Thank you for your answer. I will check firebug in the network tab as you suggest.

To answer your question about does it occur on different computers and different version of browser. The answer is yes to different computer, I have tested it on six mac on the same network and two mac on a different network. I have tested it in both firefox 5 and 7. as well as safari 5 and 5.1. I do not have access to a windows machine but do have vmware fussion running windows 7 and IE 8 which I have not been able to replicate the issue, same goes for chrome which I use most often and the issue has not occurred.

I am so sorry I do not know what you mean by testing these pages on the server? I have asked my host support to test it to see if they can replicate it and they where not able to but I have only tested it on my computer that is connected to the server. Is there a way to test on the server that I am not aware of?

Thank you again for you help and suggestions. I really appreciate it
CERTIFIED EXPERT
Commented:
Please see what "session.save_path" is set to in php.ini?

It's a long shot, but seems like perhaps it's writing the cookie data to a really slow or stale NFS share or something.

Author

Commented:
Dear xterm,

Thanks, I have checked the session.save_path in the php.ini and it is saved to /tmp on a dedicated server.
Hi

Its really a strange problem indeed.  I guess it would not be tough to debug this problem without exhaustive testing, unless you find someone who has encountered the exact same problem.

Probably your webmaster who has access to the server can try or you can hire someone to look into it.

Btw. Is it that Session is in turn using cookies? and the cookies are causing the problem? Because Sessions are generally more independent from browser issues than cookies

Most Valuable Expert 2011
Top Expert 2016

Commented:
Who is your hosting company?

If you do not have it yet, grab a copy of YSlow and use it with Firebug.  Sometimes it is very helpful to see what is taking so long.

Author

Commented:
Hi Ray,

My hosting company is Liquid Web.
I will try YSlow and see what comes up. Thanks
Most Valuable Expert 2011
Top Expert 2016
Commented:
Hey, Lightwalker.  I've used Liquid Web before and I found their telephone tech support (as well as the regular ticket system) to be very responsive.  So if you're not finding the issue with YSlow, you might want to give them a call.  Just a thought, ~Ray