Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi ekitel, there seems to be something going wrong in feed-sitemap.php during the memory-limit increasing process…

    If you can, please open the plugin file called feed-sitemap.php in the WP plugins editor and you will see starting on line 37:

    if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(XMLSF_MEMORY_LIMIT)) ) ) {
    	if ( $memory_limit = @ini_set('memory_limit', XMLSF_MEMORY_LIMIT) ) {
    		echo '<!-- memory-limit-increase="' . ( abs(intval(XMLSF_MEMORY_LIMIT)) - (int) $memory_limit ) . 'M" -->
    ';
    	} else {
    		echo '<!-- memory-limit="' . @ini_get('memory_limit') . '" -->
    ';
    	}
    }

    Please put /* in front of the first if and */ after that last } and save the file.

    If you do not feel comfortable editing PHP code, I understand. But if you can do it, please let me know the result ??

    Note that when anything goes wrong and you cannot access your WP back-end any more (because of a fatal error) you will need to remove or temporarily rename the plugin directory to disable the plugin and get your site up again…

    Thread Starter ekitel

    (@ekitel)

    Thanks for the quick reply!

    I commented out that code but it’s still not working. BTW I write PHP so this kind of thing is not a problem.

    We have this setup on 2 load balanced servers. We have a lot of control and support for server settings in case that might have something to do with it.

    I have no idea how load balancing could impact the plugin like this.

    The code that you have disabled should have been putting out source like <!-- memory-limit=... --> which I did not see in your sitemap. So that is why I concluded the error occurred in that part only. But apparently, there is more going on here.

    Do you have some server/PHP error log entries that could point us to what is going wrong?

    Else, I’d just start putting something like echo '<!-- debug -->'; in various places in feed-sitemap.php between line 46 and line 94 where the output <urlset ... starts that is never reached… Maybe the PHP function mysql2date() or the plugin function get_lastmodified() triggers an error?

    Thread Starter ekitel

    (@ekitel)

    our server should write an error_log file where the error takes place, in the plugin directory, a number of other plugins have this but I don’t see one in xml-sitemap-feed

    using debugging code it seems like it never gets past query_posts:

    // the main query
    query_posts( array(
    	'post_type' => 'any',
    //	'post_status' => 'publish',
    //	'caller_get_posts' => 1,
    //	'nopaging' => true,
    	'posts_per_page' => -1 )
    );

    Ok, the only thing I can think of here is that PHP is running out of memory for that query on such a large site as yours. Do you know how much memory is available for PHP on your servers?

    The code you have disabled with /* ... */ is actually meant to increase the memory limit to prevent such a thing happening. Could you try to re-enable that code, and find out if that code is being processed at all? I mean, your PHP might have been compiled without the –enable-memory-limit switch which leads to memory_get_usage not being a function.

    Now this is not a problem when you have control of your server(s) and are able to increase the memory limit yourself. So if you can, please try with higher PHP memory settings.

    Unless you have PHP version 5.2.1 or later…

    Thread Starter ekitel

    (@ekitel)

    looks like we’re on PHP Version 5.2.12

    Ok, then memory_get_usage should be available by default. Might it be @ini_get() or @ini_set() that are causing the code to break?

    And can you increase (or disable) the PHP memory limit manually?

    Thread Starter ekitel

    (@ekitel)

    I think maybe we just weren’t setting the limit high enough.

    in feed-sitemap.php I got rid of this condition because it wasn’t being met:
    if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(XMLSF_MEMORY_LIMIT)) ) ) {

    and in xml-sitemap.php I changed the limit to 512M (256 wasn’t enough either)
    define('XMLSF_MEMORY_LIMIT','512M');

    now it seems to work: https://inhabitat.com/sitemap.xml

    Wow… my plugin running on such a BIG website ?? but good to hear you got it working.

    Anyway, can you tell me which part of ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(XMLSF_MEMORY_LIMIT)) ) ) was not being met? I was under the impression the function memory_get_usage is available in PHP 5.2.1+ independent of how it is compiled. Subsequently, I would guess it’s the second part that is failing here…

    Any idea why? I would be grateful if you could temporarily add the following code to the template (just before the closing ?> for example) so I can see the output of:

    echo '<!-- ' . (int) @ini_get('memory_limit') . ' <> ' . abs(intval(XMLSF_MEMORY_LIMIT)) . ' -->';

    Thanks!

    Thread Starter ekitel

    (@ekitel)

    maybe it would be met now after I changed the value of that constant

    That would surprise me!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: XML Sitemap & Google News Sitemap Feeds] news feed works but not the main feed’ is closed to new replies.