Skip to main content

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  
  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

 

 

  1. Create entry in the .htaccess

    • Change to the website docroot directory:

      cd /home/username/public\_html/  
    • Open a text editor to modify the .htaccess file:

      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

 

 

  1. Copy php.ini into public_html folder unless one already exists

    • If php.ini does NOT exist

      • Copy the global PHP configuration to website docroot so that custom PHP settings can be applied to the descending content:

        cp /usr/lib/php.ini /home/username/public\_html/  
      • Open a text editor:

        nano php.ini  
      • Modify the line for memory limit:

        memory_limit = 64M  
    • If php.ini DOES exist:

      • Open a text editor:

        nano php.ini  
      • Modify the line for memory limit:

        memory_limit = 64M  
  2. Wordpress has additional memory restrictions that will need to be edited.

    • Open a text editor to edit the file shown below:

      nano wp-includes/default-constants.php  
    • Modify the lines that correllate to the information below:

      // set memory limits  

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