[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 561
  • Last Modified:

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.

thx
0
Oliver2000
Asked:
Oliver2000
1 Solution
 
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?
0
 
Oliver2000Author Commented:
Hi,

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.
0
 
GaryCommented:
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Slick812Commented:
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.
0
 
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.
0
 
gheistCommented:
Is apache using same php.ini as you are editing?
0
 
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...
0
 
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
0
 
Oliver2000Author Commented:
The error was unrelated to the tips but I found the solution for myself.
0
 
Oliver2000Author Commented:
I figured it our myself.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now