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.