[转载]Failed to read session data On PHP 7.1
2017-07-20 09:52
507 查看
从php5.6升级php7.1,报错
方案:如果是自己写了 session 处理类,继承了
比如我的情况,在读不到的时候返回的是 false,在以前版本的 PHP 中,无不良表现,现在要改成返回空字符串。
转自:https://segmentfault.com/a/1190000009603677
---------------------------------------------------------------2017-08-24------------------------------------------------------------------------
1、abstract public bool SessionHandlerInterface::write ( string $session_id , string $session_data )
返回值不是bool时,报错:
E_WARNING:session_write_close(): Session callback expects true/false return value
E_WARNING:session_write_close(): Failed to write session data using user defined save handler. (session.save_path: )
2、出现错误:
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时依旧报错
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,其他类型都会报错。
比如我的情况,在读不到的时候返回的是 false,在以前版本的 PHP 中,无不良表现,现在要改成返回空字符串。
转自:https://segmentfault.com/a/1190000009603677
---------------------------------------------------------------2017-08-24------------------------------------------------------------------------
1、abstract public bool SessionHandlerInterface::write ( string $session_id , string $session_data )
返回值不是bool时,报错:
E_WARNING:session_write_close(): Session callback expects true/false return value
E_WARNING:session_write_close(): Failed to write session data using user defined save handler. (session.save_path: )
2、出现错误:
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时依旧报错
相关文章推荐
- php提示Failed to write session data错误的解决方法
- php提示Failed to write session data错误的解决方法
- PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
- PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
- VirtualBox Failed to open a session on Ubuntu-14.04
- How to Install PHP 7 on CentOS/RHEL 7.1 & 6.7
- EndOfStreamException: Unable to read additional data from client sessionid 0x0, likely client has cl
- CoreData: error: Failed to call designated initializer on NSManagedObject 的解决方法
- hadoop错误java.io.IOException Failed to replace a bad datanode on the existing pipeline due to no more
- 解决NGINX+PHP-FPM failed to ptrace(PEEKDATA) Input/output error出错问题
- java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good
- Lamp环境下编写PHP代码时出现错误:Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
- hadoop错误java.io.IOException Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try
- 解决NGINX+PHP-FPM failed to ptrace(PEEKDATA) Input/output error出错问题
- codelgniter Failed to write session data (user). Please verify that the ...
- How to install Apache, PHP 7.1 and MySQL on CentOS 7.3 (LAMP)
- php - Fatal error: Unable to read X bytes in file.php on line 0
- [转载]How To Install Nginx And PHP-FPM On CentOS 6 Via Yum
- Fatal error: Call to** function read() on a non-object inC:*\*\select_templets.php on line *的解决方法
- Warning: require(D:\wamp\www\glink-smart\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in D:\wamp\www\glink-smart\bootstrap\autoload.php on line 1