Anyone know how to fix a fatal PHP error?

Events happening in the community are now at Drupal community events on www.drupal.org.
gttygrl's picture

I think I killed my site, and I have no idea how to bring it back. This is the error:

[20-Apr-2010 14:07:50] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24 bytes) in [..]/includes/database.mysql-common.inc on line 41

The site is supposed to launch today, but now I can't access any of the admin menus--they're all coming up with a link to the 'migrate content' module. And I'm a complete PHP novice.

Thanks,
gttygrl

Comments

Increase PHP Memory limit & restart Apache

dovidharrison's picture

It sounds like you need to increase the memory limit, for PHP, in the /etc/php.ini file. Then, restart the Apache web server. There was some discussion of this issue & how to fix it, on the node http://drupal.org/node/207036

If you can't restart Apache

maxxtraxx's picture

If you can't restart Apache (like if you are on shared hosting w/ Godaddy or somebody), it actually shouldn't be a problem; increasing your php memory limit will allow the server to run the script again provided you set it high enough.

I would recommend you just insert a line into your settings.php file instead of modifying your php.ini (in the event you even have access to it). This way you are only increasing memory for drupal and not every script on your domain (potential security problems).

Look for the section titled PHP Settings in your settings.php and just simply add:

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

This can be set to whatever limit you like but I would recommend something in powers of 2. (64, 128, 256, 512... etc)

Everyone's giving me great

gttygrl's picture

Everyone's giving me great advice (both here and at the drupal forum) and I'm trying to follow it all, but nothing's worked quite yet. For instance, is there something I should do after adding that line to the settings.php? 'Cause just refreshing my browser window isn't giving me my admin tools back. I've also deleted as many extraneous modules as I could afford, and I've sent an email to the shared webhost requesting a reboot, but they haven't responded yet.

It might be that your shared

btmash's picture

It might be that your shared hosting has locked down the amount of memory PHP can consume. Ask your shared hosting provider where the php.ini file is to update the memory amount (the variable to look for is 'memory_limit' which you can to 64M (or 128M or 256M, etc).

The other way, if you avoid going via emailing your shared provider, is to update the .htaccess file. In the .htaccess file, the variable you add is 'php_value memory_limit 64M' (or 128M, etc)

Note that if you change php.ini, you have to restart apache (it might be apachectl restart? I don't know what command your hosting provider has).

I tried .htaccess and

gttygrl's picture

I tried .htaccess and settings.php, and neither is giving me my admin tools back. Am I missing a step?

Are you still receiving the

maxxtraxx's picture

Are you still receiving the fatal error?

No new errors since lunch

gttygrl's picture

No new errors since lunch time. But when I go to, say, /admin/node/add, all I get is a themed screen that says "Create Content" at the top, and nothing else. /admin/build only gives me Blocks, Contact Form and Schema--no modules, no thirty million other things that are supposed to be there.

btmash's picture

I'm a little confused whn you say you're not getting your admin tools back. Does that mean you are still getting the white screen of death? Are you only getting the white screen of death in the admin area? Also, did you try increasing the memory limit (from 64 to 128 and so on?)

No white screen of death,

gttygrl's picture

No white screen of death, just screens that are missing all the links they're supposed to have. I can't even get a list of all my content pages anymore. And yes, I increased the mem from 32 to 64.

One other recommendation...

btmash's picture

It could be that your menus are cached. One thing I would recommend trying to do is access (assuming you are logged in - if you are not, log in as an admin) http:///admin/settings/performance and at the bottom of the page, click on 'clear cached data'. That should hopefully bring something new up.

These are the only options

gttygrl's picture

These are the only options admin/settings/performance are giving me right now:

Actions
Manage the actions defined for your site.
Logging and alerts
Settings for logging and alerts modules. Various modules can route Drupal's system events to different destination, such as syslog, database, email, ...etc.
Menu breadcrumb
Configure menu breadcrumb.
Nice Menus
Configure Nice Menus.

I've lost almost all my actionable admin tools.

However, I can still navigate

gttygrl's picture

However, I can still navigate to a page and edit it, and have it save the edits. It's just the admin pages that appear to be gone (not all, but most, and all the truly relevant ones).

I think your cache_menu table has messed up

btmash's picture

I don't know if you have access to phpmyadmin from your shared hosting but you want to look for a table called cache_menu and clear it out - then try loading the page again. Hopefully that will help.

Otherwise, come on http://webchat.freenode.net/?channels=drupal-la and someone there should be able to help.

I cleared cache_menu earlier,

gttygrl's picture

I cleared cache_menu earlier, but I'll try again now that I've changed the mem limit. If it still doesn't work, I'll head on over, thanks!

What about cache_admin_menu?

gttygrl's picture

What about cache_admin_menu? Would I screw myself further if I clear that one too?

Clearing the tables that

btmash's picture

Clearing the tables that start with 'cache' (so cache, cache_menu, cache_block, etc) shouldn't hurt as whatever content is in your site will be rebuilt that way. So there shouldn't be an issue is clearing the cache_admin menu. So long as you are now able to go back into the admin/settings/performance page from before.

BTW, you had mentioned removing modules before - which ones had you removed?

Oh man, good question. Um,

gttygrl's picture

Oh man, good question. Um, only modules that I'd installed myself into sites/all/modules. Um, TW because it didn't work for me anyway. And swftools. I didn't touch anything of the installed modules 'cause I wasn't sure which ones were expendable.

sigh Clearing the cache

gttygrl's picture

sigh Clearing the cache tables did nothing. Still can't create content, list content, edit content types, or list modules.

FIXED!

gttygrl's picture

Took awhile, but I deleted the extraneous modules, changed the mem limit in settings.php and .htaccess, cleared the cache for menu and admin_menu from phpmyadmin. This didn't work, so then I added the modules back, and then flushed all caches from the Advanced Admin Menu drupal icon (left side), and voila! Success!

Thanks for all the help! I'm totally bookmarking that webchat link for future reference.

Fatal Error/ Entire Site Down

lilacbow's picture

I am having a similar problem too. I installed Jquery_Ui. Enabled it and PopUp Module
Now my site is completing in white out, no nothing.
My apache log says PHP Fatal error: Cannot redeclare theme_popup_element_title() (previously declared in ........

also
sites/all/modules/popup_filter/popup_filter.module on line 158

This is over my head. I deleted the jquery_module thinking that would help, but it didn't so I reinstalled it via FileZilla.....
newbie I be.
Help! please

Disable modules before removing it's folder

bvirtual's picture

When a module's folder is merely removed, left behind are database tables, fields, and these lead Drupal core to display strange things. I've found the white screen of admin death is typically a missing , or similar, and that all the raw HTML is present (try the browser's "View Source" menu item), and to move around to fix/invoke admin buttons, one can copy and paste the needed Action= URL into the browser's Address field, and, if any, concatenate needed CGI parameter pairs (?key1=value1&key2=value2), to get key admin features restored, or disabled (like disabling the module whose folder has been remove). Most times, the module's folder must first be restored, as disabling a module invokes functions in the module that disable it, set core database fields the module is disabled, so core Drupal no longer tries to invoke the module's functions, etc.

I hope that suggests the solution for you to use now. Restore the module's folder, clear cache (you might have to use the copy and paste method - even from from a different drupal install to get the needed pathnames for the domain name), now go to Building Site -> Modules -> and disable the module (again you might have to copy and paste from View Source or a different web site to get the right parameter pairs for a GET - it can be done with POST as well, if you use Firefox tools to mess with the returning POST file - it's worked for me), clear cache again, and it might all come back and work fine.

I'm amazed that Drupal takes abuse at this level, and does not set database values that prevent recovery, for me, a full recovery twice now.

Peter

LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE

WSOD/ no access to website

lilacbow's picture

Thank you for the response. I am new to this and your advice is over my head. I can't get anything to appear from my website. I can only access files from File Zilla......

Would you be able to post the exact error that comes up

btmash's picture

The part where you have 'Cannot redeclare theme_popup_element_title() (previously declared in ........' means that the function theme_popup_element_title has been declared in another module that you are using. The '...' doesn't help narrow down the problem. If you have the whole project on your own computer, try to do a search for 'function theme_popup_element_title'. Then we can figure out a better resolution to the problem. Also, if you don't want the cache to be hit and served to you, add the following line to your settings.php file:

$conf['cache'] = FALSE;

This will ensure that the cache will not be served to you and you can get a better idea on resolving this problem.

Everything you asked for! Thank you for your help

lilacbow's picture

I found that bit

}

function theme_popup_element_title($title, $link = FALSE, $class = FALSE){

$href = $link ? 'href="/'.ltrim($link, '/').'"' : 'NOHREF';

$span_class =
ereg_replace('[\ ]+', '-',
ereg_replace('[^a-z0-9\ -]*', '',
strtolower(
trim(
htmlspecialchars_decode($title, ENT_QUOTES)
)
)
)
);
return ''.$title.' ';
}
Also the exact error in full

The error entry in full:
[Mon Sep 13 10:08:08 2010] [error] [client 83.221.169.227] PHP Fatal error: Cannot redeclare theme_popup_element_title() (previously declared in /home/clients/websites/w_q3c4v8/public_html/q3c4v8/sites/all/modules/popup/popup.module:210) in /home/clients/websites/w_q3c4v8/public_html/q3c4v8/sites/all/modules/popup_filter/popup_filter.module on line 158, referer: http://lilacbowyoke.com/

Also i pasted in the cache bit at the bottom of the setting.php

From the description of the

btmash's picture

From the description of the page for the popup filter module, they recommend using the popup module and the filter module within it. So I would recommend getting rid of the popup filter module since that is at the core of this issue, not jquery ui.

How to get rid of filter module....

lilacbow's picture

Should I just delete the module from FileZilla?
It's the only access I have to the module since I can not
access the website to disable it.

Resolved

lilacbow's picture

Thank you so much. I deleted it and the site came back up.

Not sure if this got derailed

yurtboy's picture

Not sure if this got derailed a bit but wondering if anyone noticed the error seemed to say
Allowed memory size of 33554432 (ie 32 megs or so) bytes exhausted
(tried to allocate 24 bytes) ie not even a meg.

My point is I see this a ton of these errors and on different servers. Sometimes the only fix is find the css file and converting it to utf8 but typically that is related to a zen theme issue
as seen here
http://drupal.org/node/881132

Any more news on this part of the issue?

Thanks