Error: Cannot send session cache limiter - headers already sent...

I'm receiving the following error:

"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rswadmin/public_html/wp-content/themes/gratitude/blogs/blogs-loop.php:14) in /home/rswadmin/public_html/wp-content/plugins/whmcs-wordpresss-integration/whmcs-integration.php on line 175"

This only seems to be popping up when I run a search within BuddyPress blogs, groups, or forums.

I'm not sure what the cause is as everything else seems to be working (for the most part), so I did some digging and found this little article on the error in general. Again, don't know if it's helpful or not, but folks seemed to thing it worked. http://www.paperstreet.com/blog/1723

I just don't know where I'd change anything, or if this is even the problem. Might you guys have any ideas on this? It's so close to being right... Don't wanna have to start the integration bit all over again. :wink:

Any assistance you guys can offer would be greatly appreciated.

PS - I did a search for this and I can't seem to find someone with exactly the same situation. Hopefully I'm not double-posting this problem.

...info:
Apache v2.2.20
PHP v5.2.17
MySQL v5.0.95

  • jonhardison

    I've got no idea what I'm looking at here. LOL! Here is the code from the loop. I'm getting this error on all BP searchs, so I guess I'd have to duplicate the change for pretty much everything, right?

    <?php
    /**
     * BuddyPress - Blogs Loop
     *
     * Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter()
     *
     * @package BuddyPress
     * @subpackage bp-default
     */
    
    ?>
    
    <?php do_action( 'bp_before_blogs_loop' ); ?>
    
    <?php if ( bp_has_blogs( bp_ajax_querystring( 'blogs' ) ) ) : ?>
    
    	<div id="pag-top" class="pagination">
    
    		<div class="pag-count" id="blog-dir-count-top">
    			<?php bp_blogs_pagination_count(); ?>
    		</div>
    
    		<div class="pagination-links" id="blog-dir-pag-top">
    			<?php bp_blogs_pagination_links(); ?>
    		</div>
    
    	</div>
    
    	<?php do_action( 'bp_before_directory_blogs_list' ); ?>
    
    	<ul id="blogs-list" class="item-list" role="main">
    
    	<?php while ( bp_blogs() ) : bp_the_blog(); ?>
    
    		<li>
    			<div class="item-avatar">
    				<a href="<?php bp_blog_permalink(); ?>"><?php bp_blog_avatar( 'type=thumb' ); ?></a>
    			</div>
    
    			<div class="item">
    				<div class="item-title"><a href="<?php bp_blog_permalink(); ?>"><?php bp_blog_name(); ?></a></div>
    				<div class="item-meta"><span class="activity"><?php bp_blog_last_active(); ?></span></div>
    
    				<?php do_action( 'bp_directory_blogs_item' ); ?>
    			</div>
    
    			<div class="action">
    
    				<?php do_action( 'bp_directory_blogs_actions' ); ?>
    
    				<div class="meta">
    
    					<?php bp_blog_latest_post(); ?>
    
    				</div>
    
    			</div>
    
    			<div class="clear"></div>
    		</li>
    
    	<?php endwhile; ?>
    
    	</ul>
    
    	<?php do_action( 'bp_after_directory_blogs_list' ); ?>
    
    	<?php bp_blog_hidden_fields(); ?>
    
    	<div id="pag-bottom" class="pagination">
    
    		<div class="pag-count" id="blog-dir-count-bottom">
    
    			<?php bp_blogs_pagination_count(); ?>
    
    		</div>
    
    		<div class="pagination-links" id="blog-dir-pag-bottom">
    
    			<?php bp_blogs_pagination_links(); ?>
    
    		</div>
    
    	</div>
    
    <?php else: ?>
    
    	<div id="message" class="info">
    		<p><?php _e( 'Sorry, there were no sites found.', 'framework' ); ?></p>
    	</div>
    
    <?php endif; ?>
    
    <?php do_action( 'bp_after_blogs_loop' ); ?>
  • Shawn

    Is that this file?
    "/wp-content/themes/gratitude/blogs/blogs-loop.php"

    According to the file headers, this code snippet is part of BuddyPress, but the path indicates that it's a theme file.

    If this is the correct file, then it looks like it's starting output after the bp_has_blogs() call... but more importantly, the session aspect of the error looks like it's being raised from a session management thing for the WHMCS integration. I don't see why every page request needs to create, update and delete session files. On a site that only gets 10,000 unique visits per week with an EXT2 or EXT3 filesystem this could add several seconds to every single page load. With 33,000 unique visits per week it could bring down your server. Why would a control panel integration need to track every visitor?

  • Shawn

    Okay, since that's the file then then it's definitely causing the problem at the blog detection script there by outputting something before the session is created. Sessions are managed via cookies, which have to be written to the client before any output because it's created and managed via the HTTP headers - which, of course, have to be sent before the content..

    I don't use WHMCS, so I don't know what functionality you require from the integration, but I guarantee that whatever features you're after, the file-based session tracking that is imposed in the WHMCS WP Integration plugin will cause more harm than good for your site.

  • Arnold

    The integration plugin uses Sessions because WHMCS uses sessions for their shopping cart so the integration plugin has to track it. Not much chance of avoiding it.

    As to the header error, the session setup occurs on the 'init' hook which is well before Wordpress starts sending anything to the page. This is a safe hook to use for such things. The theme being used apparently sends output before the init hook. This is just wrong on Wordpress. No output should be sent before the 'wp_loaded' hook in Wordpress. See:

    http://codex.wordpress.org/Plugin_API/Action_Reference

    for the sequence of actions. This is something in the Theme that is being sent too early.

  • aecnu

    Greetings,

    It appears this particular topic is now resolved/closed, if you need any further assistance please let us know.

    If it wasn't resolved, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Thank you for being a WPMU Dev member!

    Cheers, Joe :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.