将Codeigniter 3应用于新的域主机会为session_files_drive.php提供mkdir()错误 [英] Applying Codeigniter 3 to a new domain host gives mkdir() error for session_files_drive.php

查看:57
本文介绍了将Codeigniter 3应用于新的域主机会为session_files_drive.php提供mkdir()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Codeigniter框架设置,可以将其跨多个域设置作为默认起点。它给了我下面的错误。当我添加全新安装的CI3和添加数据库信息,并在自动加载后执行以下操作时,情况是一样的:

I have a Codeigniter framework setup that I move cross multiple domain setups as a default starting point. It gives me the below error. It is the same when I added a clean install of CI3 and added database info, and theese following autoloads:

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

我试图删除'session',库,错误消失了。

I tried removing the 'session', library and the error went away.

在下面看到错误:

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

我已经隐藏了域名。对此感到抱歉,但是我认为这不是至关重要。

I have hidden the domain name. Sorry for that, but I dont think thats extremly vital.

这是我的会话配置:

$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']

If you use Codeigniter's /default) file session storage driver, you need to keep in mind that it only supports absolute paths for $config['sess_save_path']

config.php指出:

the config.php states:

|   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!

根据您的环境使用以下命令:

depending on your environment use these:

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

有关< a href = https://www.codeigniter.com/user_guide/libraries/sessions.html#files-driver rel = nofollow noreferrer> CI会话文件驱动程序

PS看看 Session_files_driver.php (在您的system / session / driver目录中)。在那里您在第136行看到他们对mkdir的使用: if(!mkdir($ save_path,0700,TRUE))=>>>如果dir不可写则通过错误)

P.S. have a look at Session_files_driver.php (in your system/session/driver directory). There you see their use of mkdir in line 136: if ( ! mkdir($save_path, 0700, TRUE))=>>through error if dir is not writable)

这篇关于将Codeigniter 3应用于新的域主机会为session_files_drive.php提供mkdir()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆