tyrlaka
tyrlaka

Reputation: 154

Unable to set session.save_handler in my code

After I upgraded PHP version of my website to 7.3, I started receiving this error message:

Recoverable fatal error: ini_set(): Cannot set 'user' save handler by ini_set() or session_module_name()

After my investigation, I found that the problem is in this line:

ini_set('session.save_handler', 'user');

As I see in php.ini, the default value is "files". I try to change the value to files, but it's the same. Until PHP 7.1, everything works fine, but on PHP 7.2 and PHP 7.3, I have this problem. I really can't understand why this function not working. It doesn't return any error, just a blank page with code 200 (not 500 as server error).

How do I solve this problem?

Upvotes: 2

Views: 8321

Answers (1)

liquidity
liquidity

Reputation: 1323

PHP 7.2 dropped the ability to change the session save handler to "user" using ini_set().

Use session_set_save_handler() instead, passing it a callable argument that acts as the session save handler.

You can find the announcement in the changelog:

Improved bug #73100 fix. 'user' save handler can only be set by session_set_save_handler()

Upvotes: 5

Related Questions