应用笨3到一个新的域名托管服务商给出的mkdir()用于session_files_drive.php错误

问题描述 投票:1回答:1

我有个笨框架设置,我动跨多个域设置为默认的起点。它给了我下面的错误。这是相同的,当我添加了一个干净的安装CI3和添加数据库信息,并theese以下自动加载:

$autoload['libraries'] = array('database', 'session', 'user_agent', 'upload');
$autoload['helper'] = array('form', 'url');

我试图消除'session',库和错误走了。

下面你看到的错误:

A PHP Error was encountered
Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 136

Backtrace:

File: /customers/9/0/3/***.***/httpd.www/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /customers/9/0/3/***.***/httpd.www/system/core/Exceptions.php:271)

Filename: core/Common.php

Line Number: 564

Backtrace:

An uncaught Exception was encountered
Type: Exception

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.

Filename: /customers/9/0/3/***.***/httpd.www/system/libraries/Session/drivers/Session_files_driver.php

Line Number: 138

Backtrace:

File: /customers/9/0/3/***.***/httpd.www/index.php
Line: 315
Function: require_once

我已经隐藏了域名。对不起,但我不认为这就是非常重要的。

这里是我的会话配置:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
codeigniter codeigniter-3
1个回答
1
投票

如果您使用笨的/默认)文件会话存储驱动程序,你需要记住,它仅支持$config['sess_save_path']绝对路径

在config.php文件规定:

|   The location to save sessions to, driver dependent.
|
|   For the 'files' driver, it's a path to a writable directory.
|   WARNING: Only absolute paths are supported!
|
|   For the 'database' driver, it's a table name.
|   Please read up the manual for the format with other session drivers.
|
|   IMPORTANT: You are REQUIRED to set a valid save path!

根据您的环境中使用这些:

mkdir /<path to your application directory>/sessions/

chmod 0700 /<path to your application directory>/sessions/

chown www-data /<path to your application directory>/sessions/

要么

$config['sess_save_path'] = sys_get_temp_dir(); 
//php function which returns the directory path used for temporary files

CI-sessions files driver更多信息

附:看看Session_files_driver.php(在您的系统/会话/驱动器目录)。在那里,你看到他们将使用mkdir在管线136:if ( ! mkdir($save_path, 0700, TRUE))=>>through error if dir is not writable)

© www.soinside.com 2019 - 2024. All rights reserved.