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


  • 2020-12-01 17:25:39

    axios并发操作

    很多时候,我们需要同时向后端进行多个请求,当所有请求都返回数据后,再进行一些操作。

  • 2020-12-02 14:45:35

    Remote-SSH使用教程 VSCode

    微软开发了一个VSCode的插件Remote-SSH,可以说是目前比较完美的解决了在windows下开发linux程序的问题。

  • 2020-12-02 22:56:09

    android设置禁止横屏失效崩溃

    误区,其实这两个代码都不是禁止横屏的,可以说根本没有禁止横屏的代码,这两个代码是设置竖屏的。 并且安卓先检测xml代码,如果是竖屏就直接展示竖屏的,但是如果java代码中设置的横屏,他会先展示竖屏咱展示横屏的 。

  • 2020-12-03 10:43:18

    xshell 连接 wsl

    装上 ubuntu on windows 后,默认要先打开 cmd, 再运行 bash 进入 ubuntu 的 shell。 但是这个shell很难看,配色不好就算了,还存在各种复制粘贴麻烦、默认没进入 home 目录、各种报警声等问题。所以尝试用 xshell 登陆 ubuntu

  • 2020-12-03 10:48:41

    在window10和Linux子系统 WSL如何互传文件

    想将 window下下载的文件上传到 linux 子系统中,如何用命令实现,其实可以将文件直接拖拽到 linux 在window下的目录即可(C:\Users\yunan.hu\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs)但是在linux下用命令怎么实现呢?