I have changed my php.ini "memory_limits" directive, googled on drupal.org and more, spoken with my hosting provider (more than once), run the devel module stats, read the PHP manual regarding memory limits, even tried adjusting it in .htaccess, but I cannot load the Module listing page (admin/build/modules/list) without getting the error:

Fatal error: Out of memory (allocated 53215232) (tried to allocate xxxx bytes) in xx/yyy/sss

My hosting provider, Bluehost, says that they allow a limit of 128M, which should be more than enough, especially as I never seem to get an error that reports more than 53215232 bytes. The Devel Module generally reports a max memory usage at script end of about 43MB, but to be perfectly frank, and don't know exactly how that correlates.

I have also tried using PHP5 single, and multiple, and placed my PHP.ini file where required; both end in the same result.

Could there be a script elsewhere that is limiting the memory usage? Do modules ever do that?

I am running the most current versions of several contributed modules, but they all seem to be fairly standard:
Views2
Calendar
CiviCRM
Advanced Forum + abuse, author pane, comment subject
Advanced Help
CCK + date, email, filefield
fckEditor
Pathauto + token
devel

This is such a deal-breaker, and I can't tell if it's Drupal, a contributed module, or my host. Thanks!

jgaryt

Comments

haydenth’s picture

I'd create a php page that looks like this:

phpinfo();   

Then load the file in your browser. It should output all the details of your PHP configuration, including your memory_limit settings.

It will show where PHP is looking for your php.ini file. Make sure that is the file that is configured correctly. I hope this helps.

xmacinfo’s picture

In Drupal 6, the Status Report (/admin/reports/status) have a line listing the PHP Memory Limit. From the error message you got, I would be surprised to see the PHP Memory Limit at 128M.

Please note that you can override the memory limit in the .htaccess file.

jgaryt’s picture

thanks to everyone for the advice! My status report shows 128M, and the PHP.ini is being read from exactly where I expect it to be "/home1/mylogin/public_html/staging/php.ini ". (Staging is a sub-domain so it's in the root of that sub-domain).

Here's a screen cap of my status report and my phpinfo

http://img21.imageshack.us/my.php?image=drupaladminreport657130cd5.jpg

http://img519.imageshack.us/my.php?image=drupalmemlimitka3.png

So, if all is well with PHP, what's stopping the Modules from loading?

jgaryt

jgaryt’s picture

So, as I was completely at a loss, and was itching to do something as I had just finished a quad espresso...I migrated the whole Drupal site to my local WAMP server. That was a learning process too...especially with CiviCRM.

BUT....

The whole site works without a flaw. Memory_Limit set to 128M, and no changes to any files other than pointers to databases etc.

Guess I'll get on the phone with BlueHost...wish me luck.

-
jgaryt

jgaryt’s picture

well, after *several* rounds of communication with Bluehost, one of which I was told to "find another web host" even though I am still in the staging phase of the site and have no users, the truth finally came out. A level 1 technician sent me this explanation:

Dear client,

Our system have all kinds of internal limit that are use as a maintenance tool to help avoid server lockups by preventing customers from running inefficient scripts that monopolize unnecessary CPU time and slow your server down. Our internal memory limit is right around 50MB and our admin won't raise the limit at this time. We basically not allowing our client to run any script that requires more memory on our server.

So, they say that they allow a PHP Memory_Limit of 128M, but that's simply not true.

Is anyone running a large Drupal site on a shared hosting environment that will allow a true 128M limit? We are investigating our options for dedicated servers, but that's a little way off into the future.

-
jgaryt

cog.rusty’s picture

I encountered something similar in hostgator. They have set PHP memory_limit to 64M by default. Drupal's admin/reports/status page agrees that it is 64M. However, admin/build/modules gives me a blank page and PHP logs "PHP Fatal error: Out of memory (allocated 41418752) (tried to allocate nn bytes)". The obvious question is "why 40M"?

I got an answer saying that the cause is that I have hit one of Apache's limits, which are:

RLimitMEM 83886080 104857600 (which covers all Apache memory needs)
RLimitCPU 150 200
RLimitNPROC 25 30

Of course what interests me here is what that means in practice. If, as I suspect, Apache is never going to allow more than 40M PHP memory, then the 64M setting is meaningless, hence misleading. I am still talking with tech support (in case the limit is the CPU or the number of processes).

--------- An update:

I verified that in my case, with php memory_limit=64M and with RLimitMEM set to 80M in Apache, only about 40M were left for php web scripts:

// phpmemory.php

ini_set('memory_limit', '64M');

print 'Base: ' . memory_get_usage() . '<br />';
$pattern = str_repeat("0123456789", 1000);

print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 1000);
print '1000 x 10000 chars: ' . memory_get_usage() . '<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 2000);
print '2000 x 10000 chars: ' . memory_get_usage() . '<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 3000);
print '3000 x 10000 chars: ' . memory_get_usage() . '<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 4000);
print '4000 x 10000 chars: ' . memory_get_usage() . '<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 5000);
print '5000 x 10000 chars: ' . memory_get_usage() . '<br />';

Output:

Base: 64036
Clear: 74284 | 1000 x 10000 chars: 10074344
Clear: 74416 | 2000 x 10000 chars: 20074428
Clear: 74416 | 3000 x 10000 chars: 30074428
Clear: 74416 | 4000 x 10000 chars: 40074428
Clear: 74416 | 
Fatal error: Out of memory (allocated 262144) (tried to allocate 50000001 bytes) 

Probably only an non-web php script can use all 64M of php memory.
They agreed to raise the RLimitMEM for a subdomain and it did work.

Yura’s picture

I run the script on Hostgator which I have an account with reseller aluminium then I got same result. It's giving error if I pass around 40M:

IP: 74.53.96.132
Base: 61820
Clear: 72016 | 1000 x 10000 chars: 10072076
Clear: 72148 | 2000 x 10000 chars: 20072160
Clear: 72148 | 3000 x 10000 chars: 30072160
Clear: 72148 | 4000 x 10000 chars: 40072160
Clear: 72148 | 
Fatal error:  Out of memory (allocated 262144) (tried to allocate 50000001 bytes)
 

But their SEO hosting has different results with different IPs. I thought these are on different servers but it isn't. Here it is 5 different domain:

IP: 67.18.77.85
Base: 58836
Clear: 69032 | 1000 x 10000 chars: 10069092
Clear: 69164 | 2000 x 10000 chars: 20069176
Clear: 69164 | 3000 x 10000 chars: 30069176
Clear: 69164 | 4000 x 10000 chars: 40069176
Clear: 69164 |
Fatal error: Out of memory (allocated 262144) (tried to allocate 50000001 bytes)

UPDATE:

This one fixed by one of HG system admin with the comment of

This code is running on the same server. The issue was that the apache memory limit was bounded too low for one of your sites. I have corrected this and now they all work without issue.

IP: 64.5.42.98
Base: 57852
Clear: 68120 | 1000 x 10000 chars: 10068180
Clear: 68208 | 2000 x 10000 chars: 20068220
Clear: 68208 | 3000 x 10000 chars: 30068220
Clear: 68208 | 4000 x 10000 chars: 40068220
Clear: 68208 | 5000 x 10000 chars: 50068220

IP: 64.5.60.124
Base: 55112
Clear: 65328 | 1000 x 10000 chars: 10065388
Clear: 65460 | 2000 x 10000 chars: 20065472
Clear: 65460 | 3000 x 10000 chars: 30065472
Clear: 65460 | 4000 x 10000 chars: 40065472
Clear: 65460 | 5000 x 10000 chars: 50065472

IP: 67.18.9.106
Base: 56404
Clear: 66672 | 1000 x 10000 chars: 10066732
Clear: 66804 | 2000 x 10000 chars: 20066816
Clear: 66804 | 3000 x 10000 chars: 30066816
Clear: 66804 | 4000 x 10000 chars: 40066816
Clear: 66804 | 5000 x 10000 chars: 50066816

IP: 67.18.0.25
Base: 55484
Clear: 65752 | 1000 x 10000 chars: 10065812
Clear: 65884 | 2000 x 10000 chars: 20065896
Clear: 65884 | 3000 x 10000 chars: 30065896
Clear: 65884 | 4000 x 10000 chars: 40065896
Clear: 65884 | 5000 x 10000 chars: 50065896

tstermitz’s picture

I'm getting the same problem the moment I select civicrm in admin/build/modules . Here is the complete error:

Fatal error: Out of memory (allocated 53215232) (tried to allocate 8192 bytes) in /home/tangoorg/public_html/sites/all/modules/views/modules/comment/views_handler_field_comment_link_reply.inc on line 1

Maybe it has something to do with Views2.

Creating a page using the following script gave me my php config info, which shows php.inin out of public_html:

<?php
phpinfo();  
?>

My call to bluehost got a helpful, knowledgeable support guy who confirmed that my installation was picking up the 128m. He questioned whether Drupal was looking at a different 32M limit.

Tom Stermitz, Denver Colorado

cog.rusty’s picture

To see the memory_limit which Drupal is actually picking you can
- check the admin/reports/status page (in Drupal 6)
- run <?php phpinfo(); ?> inside a Drupal post using the "PHP code" input format (in Drupal 5).

The error message says that it hit a memory limit of about 50M, which may be due to the RLimitMEM settings in Apache that I mentioned.

The simple script which I used above was my natural response when I was given the "Contact Drupal's technical support" speech. I said "Hey, forget about Drupal and try this instead".

tstermitz’s picture

I had a browser open to /admin/modules in another computer, so I went there and turned off a bunch of modules, and selected CiviCRM again. I'm not sure that anything I did actually addressed the problem, but now I'm not getting the error.

It is well-advised to leave a separate browser open to the modules window so you can recover... turning off modules if you have to.

Tom Stermitz, Denver Colorado

tstermitz’s picture

I think they are getting more calls on this issue. The last support guy immediately knew what I was talking about, and confirmed that they won't go to 128M. He got irritated when I pushed him to ask management to consider lifting the limit. I'm not going to blame him for being caught between me and Corporate policy, and frankly, Bluehost is a bit higher than others, not to mention the fact that I've always got good service from them.

ANhosting tech support claimed 20M and their sales guy said definitively 12M... Either of those are low for Drupal, and ANhosting claims to be good Drupal support people.

On the Drupal and CiviCRM side, the developers need to be careful of memory usage.

On the hosting side, we need ratings on php memory_limits for the different hosts. It is a competitive world. If a hosting company gets a reputation for not delivering the services that Drupal requires, they could lose a whole class of webdesigners.

Tom Stermitz, Denver Colorado

jhood’s picture

I'm finding this thread very interesting, thanks for all of the great info. I now understand why I'm getting the error even though my php memory limit is 96M.

I am in the process of setting up a Drupal site with Civicrm on Bluehost and I too am having memory issues. The bad part is I just signed up for a Bluehost SSL cert and a dedicated IP in order to accept credit card payments directly though my site. Any ideas on how to get around the memory issue without switching to another host? Thanks for any help!

PS my site is https://www.aadmd.org

cog.rusty’s picture

Without switching host? If their sales dept. doesn't offer a better hosting plan and if they won't negotiate then the only thing you can do is restrict your memory needs. 96M of PHP memory is something which is not generally available to most shared hosting plans.

You could try disabling some modules. Or, if you need the memory for image manipulation, try restricting the allowed image upload size. Or try imagemagick instead of GD, in case memory consumption of external programs doesn't count.

But if you really need the memory, try a $20/month VPS hosting plan.

jhood’s picture

Thanks for the suggestions, I'm looking into reducing my memory usage. I wasn't having a problem before Civicrm, so I'm starting there and seeing what can be tweaked. As far as i can calculate, I need about 65M for it to work right now and I'm hitting the Bluehost wall at about 61M. Hopefully a little tweaking does the job.

-John Hood

silurius’s picture

After taking over a project whose hosting has been under Bluehost, I was bracing myself for a difficult support call when I ran into the PHP memory limit issue. Looks like BH has relaxed their policy a bit since some of the posts above, because I was able to allocate 96M with no problems.

The support guy referred me to a cPanel tool where the customer can opt for a single user-controlled php.ini file that gets generated on the fly in the root of your site at the click of a button. The customer can then edit that as they see fit, and then rename to php.ini once it's ready.