PHP 7 user sessions issue - Failed to initialize storage module

2017-05-31 15:49:44


















down vote

function _open should return true to avoid this error.

It can not be null or empty whatever we use either database or file.

When we use database to store session data, we keep it blank or no Boolean return. that is the main reason for this error.

class session_handler{
    public function __construct()
    {
        session_set_save_handler(
            array($this, "_open"),
            array($this, "_close"),
            array($this, "_read"),
            array($this, "_write"),
            array($this, "_destroy"),
            array($this, "_gc")
        );
    }

    public function _open($savePath, $sessionId)
    {
        return true;
    }

    public function _close() {  }    
    public function _read($id) {  }
    public function _write($id, $data) {  }
    public function _destroy($id) {  }
    public function _gc($max) {  }}

It is only for PHP 7. I do not know it is a bug or not.

https://stackoverflow.com/questions/34125849/php-7-user-sessions-issue-failed-to-initialize-storage-module


  • 2018-08-28 14:19:58

    php如何配置上传较大文件

     在php中判断上传文件的大小,但是文件一但过大,print_r($_FILES);的值就变为null了,有时候大家会遇到这么一个问题,上传小文件 时,PHP能正常获取到,但是文件一超过8M就变为空了,我在做项目的时候,就遇到这样的问题,我刚开始把最大上传文件值改为20M,在PHP.INI里 面。

  • 2018-08-28 15:09:50

    JAVA中MAP值保持顺序不变

    今天在进行JAVA开发过程中,因需要使用MAP来存放数据,同时希望MAP中KEY的顺序与放入顺序保持一致。 在使用HashMap之后,发现KEY的顺序是乱序的,每次打印还不太一样。上网查询资料之后发现:

  • 2018-09-03 13:57:27

    load average 的含义

    一般的进程需要消耗CPU、内存、磁盘I/O、网络I/O等资源,在这种情况下,平均负载就不是单独指的CPU使用情况。即内存、磁盘、网络等因素也可以影响系统的平均负载值。 在单核处理器中,平均负载值为1或者小于1的时候,系统处理进程会非常轻松,即负载很低。当达到3的时候,就会显得很忙,达到5或者8的时候就不能很好的处理进程了(其中5和8目前还是个争议的阈值,为了保守起见,建议选择低的)。