Post by MaximumLife » Sun Nov 05, 2023 7:31 pm

Hi everyone,

I hope your day is going well. I have scourged the forums for this topic and am surprised I have been unable to find it because it seems to be an issue with PHP 7.4.33 and OC 2.3.0.2. What is happening is I keep getting this error in my PHP logs:

Code: Select all

AH01071: Got error 'PHP message: PHP Warning: session_set_save_handler(): Cannot change save handler when session is active in /var/....../system/library/session.php on line 16'
Does anyone know how to solve this error?

Thank you!

Life Is A Journey. Enjoy It :)


New member

Posts

Joined
Sun Oct 16, 2022 10:17 pm

Post by ADD Creative » Sun Nov 05, 2023 11:24 pm

Somehow sessions are being started too early on your site. Check the value of session.auto_start in your PHP settings. Could also be an issue with a them or extension.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by MaximumLife » Mon Nov 06, 2023 4:40 am

ADD Creative wrote:
Sun Nov 05, 2023 11:24 pm
Somehow sessions are being started too early on your site. Check the value of session.auto_start in your PHP settings. Could also be an issue with a them or extension.
I am using the OpenCart php.ini file to manage this setting, which is set as follows: session.auto_start = Off;

What should I search for in the modification log to see what may be causing this?

Also, are you sure its not a problem with PHP 7.4?

Life Is A Journey. Enjoy It :)


New member

Posts

Joined
Sun Oct 16, 2022 10:17 pm

Post by ADD Creative » Mon Nov 06, 2023 8:14 pm

It will have always been an error, it's just the warning message was only added in later versions of PHP. I would use phpinfo() to check the session.auto_start setting and you other session settings.

Also check session_autostart is set to false in system/config/catalog.php.

You want to look for any extension that are saving data to the session and changing start up.

Try and match the time of the warnings to a request in you web access logs. This may give you a clue to where the issue is.

You could also disable your extensions one by one until you find the one causing the issue. Or do a clean install of OpenCart in another directory to prove it doesn't happen with that.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by MaximumLife » Tue Nov 07, 2023 4:12 pm

ADD Creative wrote:
Mon Nov 06, 2023 8:14 pm
It will have always been an error, it's just the warning message was only added in later versions of PHP. I would use phpinfo() to check the session.auto_start setting and you other session settings.

Also check session_autostart is set to false in system/config/catalog.php.

You want to look for any extension that are saving data to the session and changing start up.

Try and match the time of the warnings to a request in you web access logs. This may give you a clue to where the issue is.

You could also disable your extensions one by one until you find the one causing the issue. Or do a clean install of OpenCart in another directory to prove it doesn't happen with that.
Okay, so I checked the phpinfo() and the session.auto_start is set to off. All other values are set to default/master values.

session_autostart is set to false in system/config/catalog.php

I went modification by modification and disabled each one but had no luck. The problem persists, as I checked the log each time after to see if the warning still came.

The problem isn't happening on a clean install of OpenCart

Not sure but what could I search for next?

I do not know how to debug php errors to be frank. Could there be a code to debug added to the session.php file?

Life Is A Journey. Enjoy It :)


New member

Posts

Joined
Sun Oct 16, 2022 10:17 pm

Post by ADD Creative » Tue Nov 07, 2023 5:27 pm

When disabling extensions, make sure you have disabled them in Modifications as well. Compare your files against a clean download of your version of OpenCart, in case there have been changed made directly to the files.

Do you get the warning with every request? If not try and match the time of the warnings to a request in you web access logs. Or you could add the following before session_set_save_handler in system/library/session.php. This will log the path when sessions have already been started. You need to check the PHP error log and not the OpenCart one.

Code: Select all

			if (session_id()) {
				error_log('Session already started ' . $_SERVER['REQUEST_URI']);
			}

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by MaximumLife » Tue Nov 07, 2023 7:35 pm

Thank you. I was able to find the extension causing the problem. I will contact the developer of the extension.

Life Is A Journey. Enjoy It :)


New member

Posts

Joined
Sun Oct 16, 2022 10:17 pm

Post by MaximumLife » Wed Nov 08, 2023 11:34 pm

Code: Select all

require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/session/native.php');
$f = new Session();
$f->start();
$session_data = $f->data;
Here is the code causing the trouble. It is part of a page cache extension. Could I just comment the other part out, safely?

Code: Select all

require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/session/native.php');
/*
$f = new Session();
$f->start();
$session_data = $f->data;
*/

Life Is A Journey. Enjoy It :)


New member

Posts

Joined
Sun Oct 16, 2022 10:17 pm

Post by ADD Creative » Fri Nov 10, 2023 7:48 pm

It's hard to say, as we don't know what the extension is doing with that data. Probably best to wait for the developer to fix it or not to use that extension.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 95 guests