Redis不能用作Php7会话处理程序

时间:2017-08-26 15:06:54

标签: php redis php-7

我遇到了redis会话的问题。我将php7,Apache2等安装到我的ubuntu 16.04机器上。我安装了redis服务器,它可以工作。

在php中,当我使用'文件'作为php会话处理程序,php工作,但当我将php会话处理程序设置为redis并添加代码' session_start()'到我的PHP代码,它显示'此页面无法使用'。为什么呢?

这是我的php.ini文件的一部分

[browscap]
; http://php.net/browscap
;browscap = extra/browscap.ini

[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
session.save_handler = redis

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; The path can be defined as:
;
session.save_path = "tcp://127.0.0.1:6379?auth=MYREDISPASS"
;
; where N is an integer.  Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories.  This is useful if
; your OS has problems with many files in one directory, and is
; a more efficient layout for servers that handle many sessions.

当我执行' php index.php'在终端,它工作。

0 个答案:

没有答案