Getting Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64343 bytes) on either editing view or updating modules or few other operations

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Mandakini_Kumari's picture

I am getting below error either editing view or updating modules or few other operation

While edit view got below error (URL http://sitename.com/admin/build/views/edit/patient_details)
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64343 bytes) in /home/supercra/public_html/sitename.com/includes/menu.inc on line 966

While module update got below error (URL: http://sitename.com/admin/build/modules)
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2990 bytes) in /home/supercra/public_html/sitename.com/includes/database.mysql-common.inc on line 41

Any clue why it happens ?

Comments

restriction in your php file

tanay_lakhani's picture

its a server error when it is restricted by php.ini file or php configuration. Try to allocate more space for your project. Ideally provide 512MB .

Memory allocation limit reached

kkismu's picture

This error clearly indicates that PHP scipt running short of memory. One can view the allowed memory size through C Panel. Most of the hosts doesn't allow to edit php.ini.

you can insert the following statement in your settings.php

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

You can use 128M instead of 64M. Increasing this unmindful may result instability of server and may attract suspension of your account.

cheers
K Krishnamurthy
kkismu@gmail.com
+9442946688

Looks ini_set('memory_limit',

Mandakini_Kumari's picture

Looks ini_set('memory_limit', '64M'); in setting.php and
php_value memory_limit 32M in .htaccess is depreciated in PHP Version 5.2.16

I can change in php.ini from WHM but there are more then 20 site and I don't want to make memory_limit 64M for all 20 sites.
I think we can make php.ini in root of our site ? We did for 'host gator' but it is not working on 'orbit(Theplanet)'

Mandakini Kumari

php ini file in ur drupal directory

tanay_lakhani's picture

hey..you can have individual php.ini file in ur drupal directory. Make sure u copy the the php ini file to drupal directory n then edit it.
it will solve ur prob..

Then install Drupal Tweaks module

kkismu's picture

Dear mandakini

              you can install Drupal tweaks module and configure all parameters to run your site with 100+ modules. I am using in http://www.soldiersandveterans.org

cheers
K Krishnamurthy
kkismu@gmail.com
+9442946688

Set your php.ini to 256M

S.Siva's picture

hello,

Set your php.ini to 256m. Till your site has more than 1 lakhs user , do not increase above 256 , it is not recommended to increase memory limit for the sites which have users below 1lakhs users.

Enable throttle module to divide the load , it will be really help ful. Use yslow to check the performance of your site and reduce the unwanted scripts and images.

Memory Problem

headstartcms's picture

Allowed memory size of 33554432 bytes exhausted (tried to allocate 40 bytes) in /home/headstar/public_html/modules/system/system.install on line 1055

What is top5 recommended web-hosting ?

Allowed memory size of xxxxx bytes exhausted

rexwood's picture

Besides increasing the memory allocation in php.ini [which i am not able to do with the current hosting provider] what other options are there? it seems to be related to the number/type/complexity[?] of modules as i build the site. I have no users it is not completely operational but have run it o this error when trying to enable modules.

My assumption is that I am limited to the number/type of modules that I can enable, which is a challenge when trying to construct an e-commerce component using Ubercart.

Theme being used is Omega, but i have run into this with another operational site. I simply limit drastically the number of enabled modules. Almost static site some pictures, blog etc, very few active daily users..

Gives me concern when i contemplate what will happen when activity increases and things get busy. Memory limit is 32mb.

Any other resolution options?

drush

pareen's picture

If u cannot edit php.ini, and are having problems only on modules page, a quick workaround would be enabling/disabling modules via Drush. That would not throw up this error. But more and more pages will start showing this error soon. This is just a temporary solution

RAM limitations

rexwood's picture

Thanks forthe response Pareen. I am in the process of changing hosting providers to get someone who will provide greater processing capacity. Not that I am doing anything massive, just can't even get the site running!

Thanks again for your input.

no need to change host

sandeepmohanan's picture

A PHP memory limit of 32MB is the minimum requirement for Drupal 7 (16MB for Drupal 6), and 64MB is recommended. Some sites may need more than 64MB if they are using certain contributed modules such as Views and Panels. Memory limits of 128MB and higher are not unusual. There are several techniques to increase the PHP memory limit and you only need to use one of them. The right one for you depends on your system configuration.

php.ini

This is the recommended approach if you have access to the server's php.ini. This will not be possible in some shared hosting environments, though your host may be able to adjust it for you. Note that this change will affect all websites and PHP scripts on the server.

Locate the php.ini file used by your web server. You can click the "more information" link on Drupal's status page's PHP section. which shows the phpinfo() page. Locate the Configuration File (php.ini) Path row on that page. During installation Drupal checks the PHP Memory Limit, and if it is less than 32M (16MB for Drupal 6), an error message also provides the path to the php.ini file.
Edit the memory_limit parameter in the php.ini file (usually in a section called Resource Limits)
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
If there is no section already for this, place the above line at the end of the file.
Restart Apache.
php.ini in the Drupal root folder

Add the following line to a php.ini file in your Drupal root folder:
memory_limit = 64M
This will only work if PHP is running as CGI/FastCGI.

The next two solutions are more restricted in scope and, in some cases, may be more appropriate choices than affecting all sites.

.htaccess

Edit the .htaccess file in the Drupal root directory. Look for the section:

Override PHP settings. More in sites/default/settings.php

but the following cannot be changed at runtime.

and immediately after this add the following line:
php_value memory_limit 64M

This method will only work if PHP is running as an Apache module.

settings.php

If Drupal is already installed, you can edit sites/default/settings.php. This method will affect only the site using this file.
Locate the PHP settings section and add the following line at the end of that section:
ini_set('memory_limit', '64M');

Shared Hosting

In some shared hosting environments, access to the PHP memory limit setting is restricted. If you cannot make the change yourself, please ask your hosting provider to adjust it for you, or look for a new host that allows more flexibility.

For some hosts renaming php.ini to php5.ini may be necessary.

Some hosting services require the following line in .htaccess to enable a php.ini file.
suPHP_ConfigPath ~/public_html

For some hosts (CrazyDomains) you may need to add the following lines to the php.ini file (if they are not there already):
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

php.ini

rexwood's picture

Thanks sandeepmohanan for your very helpful response. No wonder things were so tight if D7 requires 32MB to run. That was the limit allocated by the hosting provider! And I had no option to extend it beyond moving to a much more expensive VPS package option. Apart from the cost there were the issues of management etc that I would then have to accommodate.
I couldn't change the allocation at all.

So I moved to new hosting providers, one who provides 512MB bursting to 1GB and the other who allows 156MB up to 1GB [based on submitting a limit change via php.ini], both at around the same cost as previously. It's probably a good things that this problem occurred at exactly this stage as it made me review things that highlighted what the real issue was - a rubbish hosting package.

Have transferred and rebuilt both sites [more to go] and can't believe the difference already.

Thanks to the advice provided here, I will be using it in the future now that a php.ini option is an option.

I am using crazy domain (webhost)

drupaldev06's picture

I have updated php.ini but its not working. I used admin_menu and banckle chat module. it is giving me memory size error. I have entered these values in php.ini
safe_mode = Off / On
upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 128M
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

When i check status report it shows 32M memory. Tell me solution what can i do?

Have you restart apache after

abhishek.kumar's picture

Have you restart apache after making above changes ?

drupaldev06's picture

how i can restart apache. I am hosting my site from crazydomain web host. I dont have permission for restarting the apache service.

Are you using shared hosting ?

Tech_Musings's picture

If your server is shared then you can update your custom php.ini and place it in your document root directory otherwise you can contact directly hosting provider and then they tell you how you can change it for your application.
Thanks,
Anil

I have done all these things

drupaldev06's picture

I have done all these things in hosting server.Without restartng apache it will not work. And I have send many mail to crazy domain host but they are not responding me. Really they are providing very bad services. Really i m cheated by them.

India

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: