Error notification
For site https://datavaultalliance.com
- Error Level: E_WARNING
- Message: session_start(): Cannot start session when headers already sent
- File: /wp-content/plugins/wpforo/wpf-includes/class-notices.php
- Line: 16
- Request: /wp-cron.php?doing_wp_cron=1585247436.2303390502929687500000
- Referrer: https://datavaultalliance.com/wp-cron.php?doing_wp_cron=1585247436.2303390502929687500000
- User:
I am using "Fatal Error Notify" to produce the warning and email me when this happens. It seems to happen quite frequently, causing my site to slow down. The indication is the error is occurring in wpForo - class-notices.php
Can you fix this please? or look into this? I realize it's a warning, but still - even warnings (happening every minute through wp-cron) slow the entire site down.
Thanks
This is NOT a warning actually but a major error. And i doubt it comes from wpForo.
Do you have DEBUG to a LOG enabled ? If so do you see any errors in there?
Also is that a new problem? An old one? A new installation? Any custom work or any manually changed code?
Hi Dear @dlinstedt
This problem has not come from the wpforo plugin.
Before the init process, your site generates some warning or other server messages, and PHP start_session() function cannot start if headers already sent.
1) You should find these problems from other plugin or theme codes and fix, to allow wpforo normally can start her session.
2) Or you can paste this code to your wp-config.php
define( 'WP_DEBUG', false);
define( 'WP_DEBUG_DISPLAY', false);
define( 'SCRIPT_DEBUG', false);
for disabling send server messages to your front, to allow wpforo normally can start her session.
You have PHP errors coming from other plugins or you have spaces/line-breaks in functions.php of the theme after ?> or before <?php tags. wpForo always displays this error when there are such problems. Those problems stop wpForo sessions and you see this error. So this is just a result not the reason. you should find the reason.
In other words, your website output is affected by other plugin error and it generates "headers already sent " NOTICE in wpForo functions. It'll generates such notices in all plugins who have session functions. So please find the plugin who generates errors or outputs in header. Deactivate those one by one and check, once the wpForo Notice is gone then the problem is fixed and you found the problem maker plugin.
Thank you for your replies. I will take your advice Martin and look deeper into the causes. I did however want to point out two things:
wpForoNotices and it's happening ONLY under wp-cron action: (I think? that under wp-cron execution, it does NOT start session in wpforo, i mean - why would it under the cron action?) wp-cron has no reason to "start a session for wpforo" does it? furthermore, isn't wp-cron kicked off AFTER the headers of wordpress are sent? I thought it was enqueued action executed after page delivery.
/wp-cron.php?doing_wp_cron=1585303603.4784479141235351562500
class wpForoNotices{
function __construct(){
$this->init();
}
/**
* @return void
*/
private function init(){
if( !wpforo_is_session_started() && ( !is_admin() || (!empty($_GET['page']) && strpos($_GET['page'], 'wpforo-') !== false ) || (wpforo_is_ajax() && !empty($_POST['action']) && false !== strpos($_POST['action'], 'wpforo')) )) session_start();
}
All that, I will Martin, take your advice and find the culprit. Thanks, Dan