我有一个 Codeigniter 框架设置,我将其跨多个域设置作为默认起点。它给了我以下错误。当我添加全新安装的 CI3 并添加数据库信息以及以下自动加载时,情况是一样的:
$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 的 /default) 文件会话存储驱动程序,您需要记住它仅支持绝对路径$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/
or
$config['sess_save_path'] = sys_get_temp_dir();
//php function which returns the directory path used for temporary files
更多信息CI 会话文件驱动程序
附:看一下Session_files_driver.php
(在您的 system/session/driver 目录中)。您可以在第 136 行看到他们对 mkdir 的使用:if ( ! mkdir($save_path, 0700, TRUE))=>>through error if dir is not writable)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)