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.
Forcing A Session To End We can use a custom hook to end a session anywhere within the theme by using the do_action function provided by WordPress to call the end_session function we created above. 1: In the functions. php file we would add the following. add_action('end_session_action', 'end_session');
“An active PHP session was detected. 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.”
In most cases, the real reason of the above errors is the incorrect mechanism for using PHP sessions within plugins or themes when they are using the session_start() function.
Now you need to identify what plugin cause this issue by deactive your plugin one by one.
Then in that plugin, you need to find a piece of code similar to this:
if ( !session_id() ) {
session_start();
}
then change it to:
if ( !session_id() ) {
session_start( [
'read_and_close' => true,
] );
}
Then you are done. In most cases, this will fix the issue. Good luck!
Had the same issue due to WP Hotel Booking plugin use. I fixed it! Took me a while to find a plugin it caused and editing the plugin .php didn’t help. But I fixed it adding a snippet of code to functions.php of the CHILD theme:
function mymodule_curl_before_request($curlhandle){
session_write_close();
}
add_action( ‘requests-curl.before_request’,’mymodule_curl_before_request’, 9999 );
Found a solution here: https://de.wordpress.org/support/topic/curl-error-28-und-andere-fehlermeldungen/
Often this critical issue is caused by conflict in SESSION when using the PHP session_start()
function.
For example I have used a Calculation plugin in Wordpress and after Wordpress version update this error occured.
So I detected the plugin which causes this issue as activated/deactivated plugins one by one.
SOLVING these errors: In File manager of my site I got the .php files of the plugin and searched for session_start()
function. Where it was used after it I used this function in a row session_write_close();
Source of the function
Regards!
To chime in with my own experience here, this very issue was resolved by turning off the “cross sell pop up” module of Shopengine Pro. Indeed there’s a session start in the php. I have notified them about this today. Maybe it’ll help someone else meantime!
I found out that you get these critical health warnings when you install a plugin or a plugin Adon and fail to complete its setup to the end. So the simplest solution is to deactivate the plugin or complete the plugin set-up. My errors were caused by a Woocommerce Adon which I deactivated and when I refreshed the health status the two issues were gone. I hope this helps.
If you tried the above and it's not working try to change the php version from your hosting's CPanel I had the same error ande i changed the php version from 7.4 to 7.3 and it all went well
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With