Codeigniter无法加载库 [英] Codeigniter cannot load libraries
问题描述
最初,我认为由于在Codeigniter中使用模块化扩展,我有一个加载库的问题。
但是我发现即使干净安装了codeigniter无法加载例如会话库
或甚至迁移库的库。
我总是收到类似的错误消息
这是我使用会话库时的错误消息。
注意:如果我不使用库,一切正常。
错误:
遇到PHP错误
严重性:警告
:mkdir()[function.mkdir]:参数无效
文件名:drivers / Session_files_driver.php
行号:117
Backtrace:
文件:index.php
行:301
功能:require_once
遇到未捕获的异常
类型:异常
消息:会话:配置的保存路径''不是目录,不存在或不能创建。
文件名:\system\libraries\Session\drivers\Session_files_driver.php
行号:119
Backtrace:
文件:index.php
Line:301
功能:require_once
这是一些形式的权限问题,但无论我使用AMPPS,MAMP(Windows)或XAMP我总是得到这个问题。
有没有任何想法
操作系统:Windows 8.1
网络服务器:AMPPS / MAMP (Windows)/ XAMP - 都有问题。
Codeigniter :v3.0.0
配置:
$ 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;
EDIT / p>
已解决。
现在使用CI3文档很重要,您使用更新的SQL创建表。
CREATE TABLE如果不存在`ci_sessions`(
`id` varchar(40)NOT NULL,
`ip_address` varchar(45)NOT NULL,
`timestamp` int(10)unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
PRIMARY KEY(id),
KEY`ci_sessions_timestamp`(`timestamp`)
);
找到此处。我希望这可以帮助任何人有类似的问题。
如果您使用
文件
请确保您将$ config ['sess_save_path']
设置为类似于'ci_sessions'
。解决方案
消息:会话:配置的保存路径是不是目录,不存在或不能创建。
$ config ['sess_save_path'] = NULL;
尝试设置此项。Initially, I thought I had a problem with loading libraries due to using Modular Extensions inside Codeigniter.
However I have discovered even with a clean install of codeigniter I am unable to load libraries such as the
Session library
or even the Migration library.I always get similar error messages usually to do with loading files.
Here is my error message I have when using the Session library.
Note: If i don't use libraries everything works fine.
Error:
A PHP Error was encountered Severity: Warning Message: mkdir() [function.mkdir]: Invalid argument Filename: drivers/Session_files_driver.php Line Number: 117 Backtrace: File: index.php Line: 301 Function: require_once An uncaught Exception was encountered Type: Exception Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created. Filename: \system\libraries\Session\drivers\Session_files_driver.php Line Number: 119 Backtrace: File: index.php Line: 301 Function: require_once
I feel like this is some form of permissions issue, but whether I am using AMPPS, MAMP (Windows) or XAMP I always get this problem.
Does anyone have any ideas
OS: Windows 8.1
Webserver: AMPPS/MAMP(Windows)/XAMP - All have the problem.
Codeigniter: v3.0.0
Config:
$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;
EDIT:
Resolved.
It's important now that you use the CI3 Documentation, When using the database method for sessions please ensure you use the updated SQL to create the table.
CREATE TABLE IF NOT EXISTS `ci_sessions` ( `id` varchar(40) NOT NULL, `ip_address` varchar(45) NOT NULL, `timestamp` int(10) unsigned DEFAULT 0 NOT NULL, `data` blob NOT NULL, PRIMARY KEY (id), KEY `ci_sessions_timestamp` (`timestamp`) );
As found here. I hope this helps anyone out with similar problems.
Also for the initial problem if you are using the
files
driver please ensure you set the$config['sess_save_path']
to something like'ci_sessions'
or wherever you wish to store. Please see @Tpojka answer for more information.解决方案
Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
$config['sess_save_path'] = NULL;
Try to set this one.这篇关于Codeigniter无法加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!