Codeigniter 无法加载库 [英] Codeigniter cannot load libraries

查看:26
本文介绍了Codeigniter 无法加载库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初,我认为由于在 Codeigniter 中使用了模块化扩展,我在加载库时遇到了问题.

Initially, I thought I had a problem with loading libraries due to using Modular Extensions inside Codeigniter.

但是,我发现即使全新安装了 codeigniter,我也无法加载诸如 Session 库 甚至迁移库之类的库.

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.

这是我在使用 Session 库时收到的错误消息.

Here is my error message I have when using the Session library.

注意:如果我不使用库,一切正常.

Note: If i don't use libraries everything works fine.

错误:

遇到一个 PHP 错误
严重性:警告
消息:mkdir() [function.mkdir]:无效参数
文件名:drivers/Session_files_driver.php
行号:117

A PHP Error was encountered
Severity: Warning
Message: mkdir() [function.mkdir]: Invalid argument
Filename: drivers/Session_files_driver.php
Line Number: 117

回溯:
文件:index.php线路:301函数:require_once

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.

文件名:systemlibrariesSessiondriversSession_files_driver.php
行号:119

Filename: systemlibrariesSessiondriversSession_files_driver.php
Line Number: 119

回溯:
文件:index.php线路:301函数:require_once

Backtrace:
File: index.php Line: 301 Function: require_once

我觉得这是某种形式的权限问题,但无论我使用的是 AMPPS、MAMP (Windows) 还是 XAMP,我总是遇到这个问题.

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.

有没有人有什么想法

操作系统:Windows 8.1

OS: Windows 8.1

网络服务器:AMPPS/MAMP(Windows)/XAMP - 都有问题.

Webserver: AMPPS/MAMP(Windows)/XAMP - All have the problem.

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;

<小时>

编辑:

已解决.

现在使用 CI3 文档很重要,当使用数据库方法进行会话时,请确保使用更新的 SQL 创建表.

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.

对于最初的问题,如果您使用的是 files 驱动程序,请确保将 $config['sess_save_path'] 设置为类似 'ci_sessions' 的内容 或任何你想存储的地方.请参阅@Tpojka 答案以了解更多信息.

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;

尝试设置这个.

对我来说这个有效

$config['sess_save_path'] = '/tmp';

这篇关于Codeigniter 无法加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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