'Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

I have a local PHP7 & Apache environment on my Mac. All my scripts from one site are showing this error at the end of the page:

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

The error-log doesn't show more detail on the cause:

[Tue Oct 10 22:37:44.981703 2017] [php7:warn] [pid 17853] [client ::1:62267] PHP Warning:  Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

I checked my php.ini, since that "session.save_path" seems to be a reference to it, and there this parameter has the default value:

;session.save_path = "/tmp"

It's the lack of detail in this error that throws me off. How can I get closer to the cause of this? Trying to pin down where this is coming from.



Solution 1:[1]

I had same issue and realized that the replace query had quotes in its table name. The error was fixed after removing the single quotes.

Incorrect

replace into 'sessions' values('value1','value2','value3')

Correct

replace into sessions values('value1','value2','value3')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Apoorv