Home > Article > Backend Development > Warning: session_start() [function.session-start]_PHP教程
Friends who can use sessions often encounter the Warning: session_start() [function.session-start] error message. This problem is actually that there is data input before the session. The solution is very simple. I will give it to you below. Summarize.
Error message in my computer
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:APMServ-v5.2.6APMServ5.2.6wwwhtdocsKingNerOAuserUserKqManage.php:1) in D:APMServ- v5.2.6APMServ5.2.6wwwhtdocsKingNerOAusercheckaccess.php on line 2
The reason is that there is output in front
Solution:
Modify session.auto_start = 0 in php.ini to session.auto_start = 1
output_buffering = change to on or any number.
Solution in Linux
Solution:
Method 1. Comment out /etc/php.ini
session.save_path = “/var/lib/php/session”
Method 2: Check the apache user and group, and then add the user to the group where the session folder is located.
Method 3, do not have any output before session_start()!
Error message 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:phpcodeadmin.php:1) in E:phpcodelogolistadminlogo.php on line 2
That is, the session variable requires temporary space in the system
session.save_path = "Set the absolute path to a valid folder"
(for example session.save_path = "C:WINDOWStemp" )
session.save_path =Remove the ' ; ' sign in front
In addition, add EVERYONE with permission to edit the folder and have write and modify permissions!