• Resolved hankris

    (@hankris)


    I’m getting a memory error when looking up the site map AFTER upgrading to the new Yoast. Is there a known issue?

    The exact errors is PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 487424 bytes) in /home/ccdtadmin/public_html/ispcespartner.com/wp-includes/class-wpdb.php on line 2320

    This points to a PHP memory setting being set too low… I’ve increase all of them (wp-config, C-Panel, php.ini, htaccess) and getting the same behavior.. This started right after the last Yoast upgrade.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • @hankris This error is typically caused by that the resources required to generate the sitemap are not available or the request is timing out due to the resource restrictions of the server environment.

    To resolve this, we would first recommend ensuring that the PHP settings for both max_execution_time and memory_limit are set to a high enough value in the PHP environment. This setting is typically controlled by editing the values in a php.ini file such as in the following example:

    max_execution_time = 300
    memory_limit = 256M

    If you aren’t sure how to change these settings in php.ini, we would recommend contacting your hosting provider for additional assistance. 

    If you are still receiving the critical error on the sitemaps after increasing both values for the PHP max_execution_time and memory_limit, the issue may be caused by that the PHP script run time restriction on the server is being reached.

    In order to reduce the amount of time necessary for the script to generate the sitemap, you can reduce the number of entries in the sitemap.

    By default, the number of entries in the sitemap is set to 1000 but by decreasing this value it will decrease the amount of resources required to generate the sitemap. To decrease the number of sitemap entries you can use the filter wpseo_sitemap_entries_per_page.

    For example, here is example code to limit the number of sitemap entries to 100:

    <?php
    
    /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
    
    /* Limit the number of sitemap entries for Yoast SEO
    
    * Yoast SEO defaults to 1000
    
    */
    
    function max_entries_per_sitemap() {
    
    return 100;
    
    }
    
    add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' );

    We also have more information on using this developer filter at the following link: Limit the number of sitemap entries entries.

    Thread Starter hankris

    (@hankris)

    increasing the max_execution_time did not change the behavior … where do I enter the php code for wpseo_sitemap_entries_per_page ?

    function max_entries_per_sitemap() { return 100; } add_filter( ‘wpseo_sitemap_entries_per_page’, ‘max_entries_per_sitemap’ )

    Plugin Support Maybellyne

    (@maybellyne)

    Typically code snippets are added to your theme’s functions.php file. If you’re unfamiliar with using code snippets, we’d like to refer you to the WordPress documentation on how to use a filter.

    Thread Starter hankris

    (@hankris)

    Thank you very much! That worked!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Fatal error -lass-wpdb.php on line 2320’ is closed to new replies.