Forums

XML & Google News Sitemap Feeds
[resolved] news feed works but not the main feed (13 posts)

  1. ekitel
    Member
    Posted 1 year ago #

    You can see both links here http://www.inhabitat.com/robots.txt. The news feed looks great, but the other one has nothing, only the headers.

    Any idea why this is happening?

    This is a multi site installation.

    http://wordpress.org/extend/plugins/xml-sitemap-feed/

  2. RavanH
    Member
    Posted 1 year ago #

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

  3. ekitel
    Member
    Posted 1 year ago #

    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.

  4. RavanH
    Member
    Posted 1 year ago #

    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?

  5. ekitel
    Member
    Posted 1 year ago #

    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 )
    );
  6. RavanH
    Member
    Posted 1 year ago #

    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.

  7. RavanH
    Member
    Posted 1 year ago #

    Unless you have PHP version 5.2.1 or later...

  8. ekitel
    Member
    Posted 1 year ago #

    looks like we're on PHP Version 5.2.12

  9. RavanH
    Member
    Posted 1 year ago #

    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?

  10. ekitel
    Member
    Posted 1 year ago #

    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: http://inhabitat.com/sitemap.xml

  11. RavanH
    Member
    Posted 1 year ago #

    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!

  12. ekitel
    Member
    Posted 1 year ago #

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

  13. RavanH
    Member
    Posted 1 year ago #

    That would surprise me!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic