WordPress.org

Forums

Fatal Error (9 posts)

  1. kfcurley
    Member
    Posted 1 year ago #

    I get this error when I try to add items to the menu.

    Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 122880 bytes) in /data/23/3/86/120/3086772/user/3439605/htdocs/wp-admin/includes/nav-menu.php on line 157

    I'm not really sure how to fix it.

  2. The Grey Parrots
    Member
    Posted 1 year ago #

    Kindly reduce your menu items / increase your memory_size.

  3. kfcurley
    Member
    Posted 1 year ago #

    Any recommendations to what I should increase it to?

  4. The Grey Parrots
    Member
    Posted 1 year ago #

    To increase PHP memory limit add such line in your PHP.ini file

    ini_set("memory_limit","24M");

  5. Using FTP you can try increasing the memory for PHP and WordPress in several different ways:

    1) You can edit the memory_limit line in your php.ini (if you have access to that file) to increase memory to 64M:

    memory_limit = 64M;

    2) Try adding the "define" line below in your wp-config.php file a few lines of white space below the opening <?php in the file:

    define('WP_MEMORY_LIMIT', '64M');

    3) If those don't work, try adding this line at the top of your .htaccess file:

    php_value memory_limit 64M

    If that doesn't work or throws a "500 Internal Server Error", delete the line from .htaccess.

    If none of those work, your host probably doesn't allow memory allocation overrides. You're stuck with what they give.

    You can run phpinfo to see what kind of memory allocation you already have. Make a plain text file and call it phpinfo.php and put just this line in it:

    <?php phpinfo(); ?>

    then put the file in the root of your server, and then go to that file with your web browser. You'l see all the php info you need; scroll down for memory settings. If you get an error, that means your web hosting company won't allow phpinfo to run for security reasons.

  6. kfcurley
    Member
    Posted 1 year ago #

    I guess that's my problem. No php.ini file.

  7. catacaustic
    very awesome
    Posted 1 year ago #

    You should set the memory limit to at least 64M. You could go more, but most times that shouldn't be required.

    I'd also suggest looking at the menu structure of your site. How many items do you have in the menu to get up over 40MB of memory used for a menu?

  8. kfcurley
    Member
    Posted 1 year ago #

    I set the size to 64mb. I only have 6 menu items - no drop downs. Seems odd to me that I ran out of memory.

  9. Use the define('WP_MEMORY_LIMIT', '64M'); line I posted above.

    Who is the webhost?

Topic Closed

This topic has been closed to new replies.

About this Topic