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 );
There's a background to this solution at: Make WordPress Core, Loopback request fails if headers set in curl
(Original link in German doesn't exist anymore and was referring to this other related discussion.)
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.
#David M., If the issue is specifically happening with the Cross-Sell Popup Module of the ShopEngine PRO plugin, then it can be fixed by adding a small piece of code on the cross-sell-popup.php file that will read and close the session of the Cross Sale Popup module immediately.
Big Thanks to #thống nguyễn for the solution.
On the line 18th, from where the session starts, replace the session_start() with the following code:
session_start([
'read_and_close' => true
]);
Hope it will help.
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
Related
I have moved my wordpress site to a new server, and login.php is working right.
But in there many plugins is not working well, for example the login page is not linked to any other page after I submitted my username and password.
Here is the login page link:
https://cpalocate.ca/login/
I have entered the invalid username and password, it will also show the blank page, but not error page.
When I add this code in wp-config.php
define('WP_DEBUG', true);
it showed this text. " Notice: Constant WYZ_THEME_DIR already defined in /home/.....".
And I have fixed that, but the same problem.
Now there is no any error debug, but the login page is also not working.
I changed the php version of my site in cpanel, but the same.
Anyone has your idea to solve this issue?
It is possible (I'd even say likely) that on your old server it was using PHP 5.6 (or at least a different version of PHP than your new server) and now you're on 7.0, 7.2 or even 7.3. It would seem that if that's the case, some of your plugins are incompatible.
You should edit your wp-config.php and add
define('WP_DEBUG', true);
so that you can see the errors on your screen, at least until you figure out which plugins are causing the problems.
If it is a matter of PHP version, check with your host to see if they can roll you back, or you'll have to either contact the plugin author and have them update the plugins, or you need to fix the code yourself, based on whatever the error messages you see are.
Edit: if this doesn't solve your problem, first try a default WordPress theme like twenty-nineteen or whatever. If that doesn't solve it, then disable each plugin one at a time until you find the culprit.
I have turned off all my plugins and turn back it one by one.
I have found one of my plugins is caused this problem, it is PM Pro Settings.
So I deactivated it and there is no any problem now.
I am using other plugins on behalf of that one.
I have this error and I seems can't get any decent answer on the web. Your answers will be much appreciated.
Thanks
Take a look at the documentation for wp_get_active_and_valid_themes(). You'll see that it's a private core function, which means plugins and themes aren't supposed to use it. It's also defined on wp-load.php. This most likely indicates one of two things.
1) Your WP Installation isn't valid. Reinstall the most recent version of WordPress and it should fix itself.
2) If you're attempting to use WordPress functions outside of WordPress (for example, in a custom PHP file), you're not properly loading in wp-load.php with require_once( 'path/to/your/wp-load.php' );
this just happened to several sites for me as well that were using WP Super Cache. i just deactivated all plugins and the theme (via wp_options db table) and reactivated them and it was fixed. strange
In reference to the following existing question. Wordpress Plugin : Can't process Indexing Queue I was unable to participate in the comments due to having a new account and less than 50 reputation.
I am having a problem getting the Algolia WordPress plugin to process the index. Running the latest version of WP and just downwloaded the WP Plugin from Algolia today. When I run WP_DEBUG and WP_DEBUG_LOG in my wp-config file I get the following output on any WP back end page.
has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /var/www/html/dealer/wp-includes/functions.php on line 3890
Line 3890 in wp-includes/functions.php just references the code that generated the error.
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
This appears to be an unrelated issue.
I should point out that this is a dev test server running locally on our internal network. I'm starting to wonder if that's causing the issue. I installed the same plugin on our live version of the site and everything works as expected.
We have never noticed any logs related to user capabilities. Your best bet to remove those notices is to:
Be sure all your plugins are updated,
Disable/Test/Enable plugins one by one to locate the plugin raising those.
Please ensure that all the requirements are met: https://community.algolia.com/wordpress/installation.html
Do you have any errors logged on the "Logs" page of the Algolia plugin?
Might be useful to also give us the list of plugins you are using.
i just:
moved a remote wp network installation to local (mamp). everything fine.
installed a new theme. everything fine.
activated the new theme. doh!
i started going through the code and i found that it doesn't fix it, but at least i got a nice-relaxing-blank-white-page, if i remove the *do_action( 'init' );* from wp-settings.php.
i googled a while and i found that "*Your problem is probably wp_cron being called by init. In 2.1 and up, the cron process is called externally, so one thing that could be your problem is the DNS resolution not working on your webserver to find its own address.*"… i don't know if this could be the right answer to my issue, what am i supposed to do to fix it all?
ty!
To determine what the actual error is, you will want to turn on debugging. To do this, add the following line to your wp-config.php file:
define('WP_DEBUG', true);
It should then start spitting out lots of textual data as to what the error is. In all likelihood, it is a PHP error due to a coding issue (bad function call, missing end tag, etc.) in the new theme, or a difference in configuration between your live site and MAMP setup.
For more info on WordPress debugging, see http://codex.wordpress.org/Debugging_in_WordPress.
I automatically updated my wordpress installation to the latest version. Everything looked normal unit "updating database..." where it got stuck. I waited for a long while and then closed the page, since nothing was happening.
Then I got a error message saying something about maintenance, which I got rid of after deleting the maintenance file.
Wordpress displays that it runs the latest version, but when I try to reinstall I get the same errror. I've tried disabling all plugins and switch to the default theme, but no luck.
I set the debug to true and I got this message:
Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information.
Everything looks normal except a image on the front page is breaking the layout.
Any tips?
The way I fixed this type of problem, was to do a global search in my project for the function call.
Some plugins had been installed which had calls such as this:
register_uninstall_hook(__FILE__, array($this,'uninstall_removedata'));
but it should be this:
register_uninstall_hook( __FILE__, 'uninstall_removedata');
If you see a message that something is called incorrectly, the Codex can be very helpful to make sure you use the correct syntax.
In this case it is here:
http://codex.wordpress.org/Function_Reference/register_uninstall_hook
Some WordPress Plugin which you have installed is firing the uninstall hook and is not setup properly.
Can you find the path to the file from the error message?