Home > Article > Backend Development > Error when php uses session
1. The error reported when PHP uses session is as follows:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
Solution:
1. Change output_buffering=off in php.ini to output_buffering=4096
2. Change output_buffering=off in php.ini Is session.save_path set up?
3. Change session.auto_start = 0 in pgp.ini to session.auto_start = 1
4. PHP code session_start( ) There must be no output before it, and it must be placed on the first line; any characters before the PHP code of session_start() are regarded as headers. That is, put session_start();......?> at the beginning of the file, and there cannot be any characters in front of
If the above four methods cannot solve the problem, you can use UltraEdit-32 Save it as UTF-8.
2. The error reported when PHP uses session is as follows:
Warning: session_start(): Cannot start session when headers already sent in
Warning: Cannot modify header information - headers already sent by (output started at
The error reported here is that there are extra spaces, as shown below.
Remove the extra spaces and you can .
Recommendation:php server
The above is the detailed content of Error when php uses session. For more information, please follow other related articles on the PHP Chinese website!