Wordpress Fatal Memory Error

This article covers the Wordpress Fatal Memory Error and how to solve it.

-----------------

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 491520 bytes) in /home/username/public_html/wp-includes/class-simplepie.php on line 9907
-----------------

Step 1: See suphp is the default handler on the server

Run : /usr/local/cpanel/bin/rebuild_phpconf --current

Sample output:

Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp  <----suphp is the default handler  *If server is running "dso" please refer to DSO section.
SUEXEC: enabled

 

 

 

Step 2: Create entry in the .htaccess

cd /home/username/public_html/

nano /home/username/public_html/.htaccess

Add the following to this file:

<IfModule mod_suphp.c>

suPHP_ConfigPath /home/USERNAME/public_html/

</IfModule>

*MAKE SURE TO REPLACE THE USERNAME WITH THE ACCOUNT USERNAME

 

 

 

Step 3: Copy php.ini into public_html folder unless one already exists

If php.ini does NOT exist
=====================
cp /usr/lib/php.ini /home/username/public_html/

nano php.ini

Edit:

memory_limit = 64M
=====================

If php.ini DOES exist
=======================
nano php.ini

Edit:

memory_limit = 64M
=======================

 

Wordpress has additional memory restrictions that will need to be edited.
nano wp-includes/default-constants.php

// set memory limits
if ( !defined('WP_MEMORY_LIMIT') ) {
if( is_multisite() ) {
define('WP_MEMORY_LIMIT', '64M');   <------Change value to reflect php.ini
} else {
define('WP_MEMORY_LIMIT', '64M');   <------Change value to reflect php.ini
}

----------------------