Explainable PHP memory limit problem?

Hi experts,

I have a strange problem with my own php script. I run my own php forum and just changed some code. The main topic view page does a lot of things and during I work on my script I started getting problems with Firefox to open the page. The browser start loading sometimes and just freeze for a moment or just open a white page with no errors.

My code contain mainly php,html and some javascript so I started debugging by taking things out and see if it works. The problem seem not my code because I could take random things away and everything worked and place the code again to take something else out and it worked also. but never together... Based on this I checked my apache error_log and find the error:

PHP Fatal error:  Allowed memory size of 8077888 bytes exhausted (tried to allocate 222519 bytes) in Unknown on line 0

But when I check my php.ini I do have configured 128MB as memory limit. When I test phpinfo(); in the same script / directory etc. I get also the information that I have 128 MB configured. I also tried:

echo 'Memory Limit = ' . ini_get('memory_limit') . "\n";

which as well return 128MB in the beginning of my code and at the bottom as well (in case some include etc. mess the code up).

I keep getting the error of the exhausted memory limit but only for this file (everything else works).
The odd thing to me is that this is not happening for google chrome browser. If I open the same page with google chrome the page opens normal and my apache log does not register any error but in Firefox I cant open the site (all white) and the apache error log shows the memory limit error.

I really don't know what to do and appreciate in advance any tips and help to solve this mystery.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
I've been getting a few 'white pages' with Firefox 31 recently here on E-E.  Are you running Firefox on the same machine as the web server?  I'm wondering if Firefox is using up all the available memory and not leaving enough for PHP.  How much RAM do you have on that machine?
Oliver2000Author Commented:

I'm working with my local computer but the server is external developer machine. Also this happen not only from my but also from friends pc. Same situation.

The developer machine is dedicated Linux server with 8GB memory RAM.
Have you tried the simple step of increasing your memory?
Something is eating memory up, have your tried Xdebug - it may help you narrow down the offending script.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

greetings Oliver2000, , ever since I updated firefox to ver 31, I have trouble with loading pages on several web sites, Today it could not load the Yahoo page at all, the day before the yahoo page would never stop loading, although it did show properly. I am guessing this may have something to do with your problem. I figure that firefox is scrambling the URL components so the POST is not correct and therefore may effect the servers responding correctly? ? But this is a WILD GUESS, on my part, since it may be only internal to firefox programming, and not on server?, , did a web search and not find much on version 31, and problems, but my search terms may need to be better. But server side processes are usually totally separate from the browser, except through the URL info sent.
Dave BaldwinFixer of ProblemsCommented:
Unless your version of Firefox is corrupted, I doubt that Firefox is causing your problem.  I use Firefox 31 everyday designing forms and doing POSTs without any problems.  The main difference I see between Firefox and Chrome is that Chrome is a lot faster sometimes.

In addition, Firefox on your computer can not cause a memory problem on the server, especially one that fails at 8MB when you are supposed to have 128MB available.
Is apache using same php.ini as you are editing?
Oliver2000Author Commented:
@gary: The server has enough memory and in php.ini is 128MB configured. also phpinfo and  ini_get('memory_limit') show 128MB. I try in the moment xdebugger but dont know how to use until now to find such a problem.

@gheist: yes, 100%. As I wrote before phpinfo and  ini_get('memory_limit') both show 128MB limit but the scripts die at 8MB anyway. even if I ad  ini_get('memory_limit') in exactly the script I use I get 128MB but it still breaks down at 8MB with php fatal error for memory exhausted.

@everybody: I was be able to switch off the problem by switching of gzip compression for this file. Like this the php interpreter dont spit out any error but the side loads hangs during load. At first all appear fast... suddenly firefox gets unresponsive for 10-20 seconds, than continue and load the rest of the side. But again, this happen not in google chrome. I try to debug with xdebugger and other tools.

I keep you guys posted and any tip on how to use xdebug best in this case are welcome. I installed webgrind and xdebug already, I use xdebug_start_trace and profiler and I get a log file on my server but did not get webgrind to read it yet. I am on it as we speak...
Oliver2000Author Commented:
Found the problem!

As it turns out this was caused by a bug in jquery in combination with foundation 5 tooltips. There is some bug which stalls the entire page load if you use to many tooltips in one page. Since this was the topicview of a forum this site contained a bunch of tooltips (for each post) and there for hit this bug. Once I switched the tooltips off everything works.

I found this with firebug event handler where the http://sizzlejs.com/ took amazing long. Once I figured it could be http://sizzlejs.com/ and foundation I found the bug reports.

This might be not a problem for google chrome but for firefox. I dont know how this all combined to bring up the php memory exhaust error even with all the free memory but it works now perfecly since I took the tooltip out.

thanks everybody for your tips

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Oliver2000Author Commented:
The error was unrelated to the tips but I found the solution for myself.
Oliver2000Author Commented:
I figured it our myself.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.