[Solved] Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path:


Warning: Unknown: Failed to write session data using user-defined save handler. (session.save_path: D:\Software\phpstudy_pro\Extensions\tmp\tmp) in Unknown on line 0

Reasons:

1. the path of session.save_path is not correct
2. session.save_path's file permissions are not correct
3. and other reasons for the error, (but mine is not the problem) this problem sent me a day of time

My mistake:

The session that occurs when using this method_set_save_handler(‘open’,‘close’,‘read’,‘write’,‘destory’,‘gc’);

reason

	1. the read callback function must return the value of the string, if not, other errors will be reported
	2. write callback function must return true, if false will return the above error
	3. write in the insert statement of the variable value must be added to the single quotes, otherwise it can not be inserted into the database
	4. all but the read callback function must return a bool value, write must return true to insert into the database, and the others I think should also return true (not tested here)

Encounter this wrong idea

1. Check the configuration file for errors first
2. then check for errors in the return value
3. then check the sql statement for errors
4. debug with echo or var_dump at each step

If you solve the big guys’ problems, please give me a favor.

Read More: