- AuthorPosts
- August 27, 2020 at 2:50 pm #26174Paul KingGuest
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?
August 27, 2020 at 2:50 pm #26173Paul KingGuestThe 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?
August 27, 2020 at 3:00 pm #26192Joseph WKeymasterHi 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.
October 21, 2020 at 10:56 am #28458zakirGuestplease 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.October 21, 2020 at 12:38 pm #28468Jesse OwensKeymasterHi 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.
October 22, 2020 at 12:32 pm #28492HenryvGuestPlugin 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.October 22, 2020 at 12:36 pm #28507Jesse OwensKeymasterHi 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.
November 2, 2020 at 7:32 am #28754Royan ShawGuestSame 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.
December 4, 2020 at 9:55 am #31934Ashiq RaazzGuestGreatings,
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
-CheersDecember 7, 2020 at 12:01 pm #31974CBD Hemp FarmsGuestI found snippets of rankmath all over the store in attributes, even after uninstalling 🙁
December 7, 2020 at 12:03 pm #32000Jesse OwensKeymasterHi 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.February 15, 2021 at 3:06 pm #33791automatic door dooraldoorGuestI 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?
February 15, 2021 at 3:13 pm #33852Jesse OwensKeymasterHi 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.
March 2, 2021 at 5:11 pm #34484RJTGuestIn 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.
March 29, 2021 at 2:46 pm #35410GlennGuestI 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?
March 29, 2021 at 2:48 pm #35454Joseph WKeymasterHi 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!
March 30, 2021 at 11:11 am #35485GlennGuestThanks 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.
April 5, 2021 at 10:09 am #35679SundaraGuestAshiq, That was it for me. Thanks so much 🙂
- AuthorPosts
- The topic ‘[Resolved] A PHP session was created by a session_start()’ is closed to new replies.