Uvoy Fact

Let’s resolve this critical error, “an active php session was detected.” Follow those easy step-by-step process!

It shows in your wp-admin at the “Site Health status” that a PHP session has been detected (critical error)

Or, If you installed a WordPress plugins called ” Health Check & Troubleshooting” (which was developed by The WordPress.org community), You may see this notification that “an active php session was detected.”

If you have an unison plugin, it’s a standard error.

An Active PHP Session Was Detected WordPress solution

how to fix an active php session was detected

Firstly, You need to find out which plugins are causing these errors.

Except for the Health Check & Troubleshooting plugin, deactivate all the plugins.

Select  > Tools > Site Health.

You will see this notification has vanished. Then, install and refresh the site health page one by one until this error appears.

When you can identify the plugins, Bingo, you found it.

For better sure, deactivate it to see if it is the main problem?

Login to the cpanel and under the root file or plublic_html
Go to

Wp-content/plugins/ now select the plugin file which is causing then /framework/includes/hooks.php

In my case, an active PHP session was detected caused by Unyson.

wp-content/plugins/unyson/framework/includes/hooks.php

Then open the file or download it. It should be at 231 lines.

				
					if ( !session_id() ) {
    session_start();
}
				
			

Now place this following code ⬇ to the Hooks.php by copying from here. 

				
					if ( !session_id() ) {
    session_start( [
        'read_and_close' => true,
    ] );
}
				
			

Why this happen

A PHP session began through the session_start() technique. Most of the time, the reason for the above oversights is that plugins or themes that apply the session_start() method misuse PHP sessions.

Before making any HTTPs calls, session_write_close() should be executed to close the session.

Leave a Reply

Your email address will not be published. Required fields are marked *