Topic Resolution: Resolved
Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #26174
    Paul King
    Guest

    The WordPress 5.5 site health page for our BoldGrid site reports this as a critical site health error ‘A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.’ How do I resolve this issue?

    #26173
    Paul King
    Guest

    The WordPress 5.5 site health page for our site reports this as a critical site health error ‘A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.’

    How do I resolve this issue?

    #26192
    Joseph W
    Keymaster

    Hi Paul,

    The error you described seems to be caused by some plugins conflicting with the newest WordPress version.  I found a thread in the WordPress support forums related to this error and it seems that one of the primary sources of this conflict is the WooCommerce plugin.

    If you are not using WooCommerce on your site then the problem is likely coming from a different third plugin and you can test which one is having issues by deactivating all of the plugins on your website and reactivating them one by one.

    I created a testing installation with only BoldGrid plugins installed/activated and did not see the error so hopefully it isn’t one of ours, but please let us know if you find anything to the contrary and we will continue to investigate this issue.

    #28458
    zakir
    Guest

    please resolve this error
    A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.

    #28468
    Jesse Owens
    Keymaster

    Hi Zakir-

    This issue has come up with users running the latest version of WordPress, and may be caused by a plugin that hasn’t been updated to resolve the error.

    Your first step should be to make sure that all of your plugins are up-to-date. If they already are, you may need to deactivate them one-by-one to determine which plugin is causing the issue.

    #28492
    Henryv
    Guest

    Plugin causing conflict with Woocommerce after WordPress update.
    Step 1 – Updated all plugins
    Step 2 – Search for a plugin conflict.
    Step 3 – Found when disabling Rankmath plugin, Woocommerce goes back to normal.
    Next step – find a fix for rankmath plugin or change to an alternative.

    #28507
    Jesse Owens
    Keymaster

    Hi Henryv-

    Glad to hear you were able to identify the plugin conflict. You can let the Rank Math team know about this issue on their Support Forum.

    #28754
    Royan Shaw
    Guest

    Same here with this nagging issue. Apparently I have installed RankMath some time ago, deleted it as it was causing issues and conflict with the theme I’m using.

    Even though having deleted the RankMath plugin there are still scraps of the plugin running in certain function files on my site and it’s damn hard to find these and delete them.

    Honestly I give up, I will ignore this for now and come back around to it when my mind is good and ready.

    #31934
    Ashiq Raazz
    Guest

    Greatings,

    Recently I Was Gettings same problem,
    Actually, This error comes from conflict plugins,

    When I disabled -Unyson plugins, it’s automatically gone…..

    so, 1st deactivate all plugins, and see which one is backdated and conflict in your WordPress
    -Cheers

    #31974
    CBD Hemp Farms
    Guest

    I found snippets of rankmath all over the store in attributes, even after uninstalling 🙁

    #32000
    Jesse Owens
    Keymaster

    Hi CBD Hemp Farms-
    Sorry to hear about the trouble with RankMath still causing issues with this error. I’d recommend reaching out to their support team directly to see if they can help you resolve the errors.

    #33791
    automatic door dooraldoor
    Guest

    I also saw this problem but I could not solve it. I had previously installed the Rank Math plugin on the site, but now I have removed it. Could it be because of this?

    #33852
    Jesse Owens
    Keymaster

    Hi Automatic Door-

    This bug should be resolved in most mainstream plugins by now. Check your list of plugins for anything that hasn’t been updated in a few months, and try temporarily disabling them to see if the error is resolved.

    #34484
    RJT
    Guest

    In case it helps anybody, like me, searching for a solution to this problem and trying all the suggested answers and coming up blank:

    Another possibility if you have an Apache server is that somewhere in your configuration a required setting is disabled that is required by WordPress/WooCommerce and ‘AllowOverride’ is set to ‘None’. Even though you have the correct settings in your .htaccess file and everywhere else in WordPress, if overrides are disabled the redirects won’t work properly and you’ll get a 404 for the WooCommerce json link.

    Oddly, regular WordPress redirects (ie ‘pretty links’) worked fine for me, so I’m still not entirely sure why redirect for the JSON url failed.

    #35410
    Glenn
    Guest

    I wrote a custom plugin which starts a session when my admin menus are loaded and then ends the session on logout of a user or login of a user. After deactivating and reactivating all plugins, mine seems to be the one causing this error.

    I am using the recommended code for starting sessions:
    add_action('init', 'start_session', 1);
    The function is in functions.php:

    function start_session() {
    	if(session_id() == "")
    	{
    		session_start();
    	}
    }

    Sessions are ended with this function:

    add_action('wp_logout','end_session');
    add_action('wp_login','end_session');
    function end_session() {
    	session_destroy ();
    }

    I have tried, alternatively, adding add_action('init', 'start_session', 1); in each menu function but (as I suspected) it won’t trigger unless at the top of the file.

    Can you offer advice?

    #35454
    Joseph W
    Keymaster

    Hi Glenn, sorry to hear about the problems with your custom plugin!

    Unfortunately we are not adequately equipped to offer custom PHP development advice, but you might want to try posting your question in the WordPress Development group on StackExchange to see if anyone there can help you figure out how to get  your plugin implemented properly.

    Good luck getting your plugin to work and please let us know if you have any other questions for us!

    #35485
    Glenn
    Guest

    Thanks much. I’ve explored this question elsewhere also and I’m coming to the conclusion that the error (“A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests”) means exactly what it says. REST API is incompatible with php sessions — at least those initiated by session_start(). If this is true, all WordPress versions beyond 4.8 (possibly beyond 4.7) will henceforth throw this error in the presence of php sessions. So (if true) WordPress is now incompatible with Sessions. My current solution is to store the information I stored in Session variables in permanent cookies. I should be able to delete the cookies on logout or login – which gives me (largely) the same effect as Session cookies.

    #35679
    Sundara
    Guest

    Ashiq, That was it for me. Thanks so much 🙂

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘[Resolved] A PHP session was created by a session_start()’ is closed to new replies.