从php5.6升级php7.1,报错php
1 Warning: session_start(): Failed to read session data: user (path: ) 2 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /datas/htdocs/test.php:16)
方案:若是是本身写了 session 处理类,继承了 SessionHandlerInterface
接口,在 PHP71 中要保证 read
方法,返回的是一个 string
,其余类型都会报错。segmentfault
好比个人状况,在读不到的时候返回的是 false,在之前版本的 PHP 中,无不良表现,如今要改为返回空字符串。swoole
转自:http://www.javashuo.com/article/p-gfjfgucy-nt.htmlcookie
---------------------------------------------------------------2017-08-24------------------------------------------------------------------------session
一、abstract public bool SessionHandlerInterface::write ( string $session_id , string $session_data )php7
返回值不是bool时,报错:spa
E_WARNING:session_write_close(): Session callback expects true/false return valuecode
E_WARNING:session_write_close(): Failed to write session data using user defined save handler. (session.save_path: )blog
二、出现错误:继承
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /datas/htdocs/root/swoole.php:67)
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /datas/htdocs/root/swoole.php:67)
须要修改对应配置:
ini_set('session.cache_limiter', false);
ini_set('session.use_cookies', false);
PS:参照手册(session.cache_limiter 指定会话页面所使用的缓冲控制方法(none/nocache/private/private_no_expire/public)。默认为 nocache。)设置为none时依旧报错