I recently reinstalled CentOS on a server for a client and then proceeded to install their WordPress web site on the fresh install of CentOS Linux. After working through various minor issues the WP site was up and functioning without issue but after a week or so they contacted me to let me know that they could no longer view items in their FAQ system via the WordPress administration site. The FAQ system is a WordPress plugin called FAQ Builder and is a great little system for frequently asked questions. Below I describe the error received when attempting to access the FAQ Builder admin and what I did to resolve the issue.

PHP Error In Apache Logs When Accessing FAQ Builder In WP Admin:

[Thu Apr 01 21:14:57 2010] [error] [client 192.168.0.35] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /var/www/wp-site/wp-includes/kses.php(413) : runtime-created function on line 1, referer: http://www.example.com/wp-admin/admin.php?page=faq-builder/faq-builder.php

As you can see above the issue appears to be the amount of memory available to PHP. Even though the issue is with the FAQ Builder admin loading the PHP memory allocation error is caused by the kses.php file which is an open source HTML/XHTML filter written in PHP. The error shows 33554432 bytes exhausted which is the default maximum of 32MB of memory allowed for a single PHP script to use. You only want to allocate enough for the script to work plus maybe a little bit more so at a maximum I would first attempt to double the current maximum memory allocated to each PHP script as shown in the example below to see if that resolves the issue.

Modify PHP memory_limit Setting Under php.ini Resource Settings:

Original php.ini memory_limit Setting:

memory_limit = 32M      ; Maximum amount of memory a script may consume

Updated php.ini memory_limit Setting:

memory_limit = 64M      ; Maximum amount of memory a script may consume

In the case of the example issue with the WordPress plugin FAQ Builder doubling the allocated memory available to each PHP script resolved the issue. After making a change to memory_limit in php.ini you will need to restart Apache or whatever your web server is for the change to take effect.


List Price: $39.99 USD
New From: $21.47 USD In Stock
Used from: $1.96 USD In Stock


List Price: $34.99 USD
New From: $26.50 USD In Stock
Used from: $4.00 USD In Stock

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , , , , , , ,
4 Responses to “PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes)”
  1. Pankaj says:

    please solved this:
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 491520 bytes)
    in /home/gpunique/public_html/wp-admin/menu.php on line 254

    [Reply]

    alex Reply:

    Hello Pankaj.

    Did you read the article? The steps in the article explain exactly how to resolve this issue. If you are not the admin or you don’t have access to php.ini then you can attempt to make these modifications in the .htaccess file located in the root directory of the web site having the issue. Please be more specific in your questions as its frustrating when you spend time writing an article to help others and they ask the same question that is solved in the article itself without clarifying if they had some type of error that prevented the solution presented.

    Thanks.
    alex

    [Reply]

    Miles Reply:

    With WordPress the other option is to put
    define(‘WP_MEMORY_LIMIT’, ’64M’);
    in to wp-config.php

    [Reply]

    alex Reply:

    Hello Miles,

    Absolutely. Thanks for providing the extra possibility for resolution!

    Thanks.
    alex

    [Reply]

  2.  
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*