Hi, I have a website running largely based on the opensource osCommerce php. Recently we have experienced problems with pages crashing half way through loading. This seems to occur randomly maybe about 5-10% of the time you load a page. What happes is that the page will start loading and then the server just seems to stop parsing the page and the users browser sits there waiting for more information indefinitly. If you hit stop and refresh then the page usually loads fine straight away. As far as I can make out this has to be somthing related to the server, not to the scripts as it seems to happen randomly and can happen one time while loading a page and not the next when loading the same page under the same circumstances 30 seconds later.

Does anyone have any idea what could be causing this? You may have a look at the website and see the problem yourself: http://www.printedimage.co.nz it will usually occur within clicking through to 10-15 pages.

We have taken the issue up with our isp, they say although they can see the problem occuring on our site, it is not occuring on any others running on the same server. They have suggested that it may be something in our local php config causing a conflict. However, this hasn't been changed lately and the probelm has just started occuring recently.
One possible idea I had was that some prcess in running in the background on the server and chewing up memory causing intermittent crashes. I have checked for any persistent database connections left running and found nothing. One thing I was wondering is if it could be a redundant email address - if used from the send mail function to an address that does not exist, could the server keep trying to contact the mail address and therfore get blocked up with such a request??

Any help or suggestions anyone can offer would be most appreciated.

Thanks, Kai

Hmmmmm. I can see the problem with the hangs. If you do a View, Source when the problem occurs, you can see that only half of the client-side code has been delivered. That's why the page is blank.

My first guess would be a hangup with the database. You could have a corrupted table that is intermittently hanging.

Another possibility is a require or require_once statement that is failing. The difference between require / require_once and include / include_once is that with the require statements, your code will stop executing when you run into an error. You might want to check the code near the point where the html ceases delivery. Look for statements that may be preceded with the @ symbol, because that prevents an error message from displaying.

I worked with an osCommerce site a few years ago. I know it is popular and free, but I found it to be buggy and inefficiently written. It's riddled with excessive numbers of include and require statements.

Do you see any patterns occurring in yoru server error logs?

I dont have much experience with it, but it seems you can cause hangs if php tries to create a or read from a resource, and it does not respond, causing php to just wait.
The resouce can be a file stream, mysql resource, or http stream etc.
With osCommerce I'd guess mysql, and as TopDogger said.

The thing to do would be to try and weed it out of your server error log.

The server error log is seperate from the PHP error log. PHP errors only show up in the server error log if PHP sends its errors there.
In this case, PHP does not know theres an error yet the server is terminating the process php is asking for, or the process is just taking too long.

Try repairing and optimizing your database.