Kohana 3.3不使用MySQLi驱动程序 [英] Kohana 3.3 not using MySQLi driver

查看:77
本文介绍了Kohana 3.3不使用MySQLi驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个使用Kohana 3.3的项目. 我遇到了要连接数据库的问题.该应用程序告诉我它正在使用MySQL,并且已弃用.

为解决此问题,我下载了Kohana 3.3的MySQLi驱动程序,并按照说明进行操作(在modules文件夹中创建mysqli文件夹,并在bootstrap.php中添加新行以启用它).

但是,当我尝试执行任何数据库操作时,它仍然说它正在使用MySQL. 该错误显示为:"Database_Exception [8192]:mysql_connect():不建议使用mysql扩展,以后将其删除:改为使用mysqli或PDO".

我用于启用模块的行是'mysqli' => MODPATH.'mysqli', // MySQLi support for Kohana

我正在使用的MySQLi驱动程序是(链接到github). /p>

任何人都可以看到出了什么问题吗?

谢谢.

解决方案

仅启用模块是不够的.

自Kohana 3.3起,自动加载器区分大小写,因此MODPATH/mysqli/classes/kohana/database/mysqli.php应该变成MODPATH/mysqli/classes/Kohana/Database/MySQLi.php.

您必须编辑APPPATH/config/database.php并将驱动程序设置为"MySQLi",或将Database :: $ default设置为正确的默认数据库实例名称. (使用"MySQLi"作为驱动程序的驱动程序.)

并且请确保不要在APPPATH之外编辑配置文件.而是,将文件复制到APPPATH并编辑该文件.通常,您不必编辑APPPATH之外的文件.当然允许更新模块以使用新版本.但是APPPATH之外的配置文件应作为示例/蓝图.

I'm working on a project that uses Kohana 3.3. I've run into a problem where I want to connect to a database. The application is telling me it's using MySQL and it's decrepated.

To solve this I've downloaded a MySQLi driver for Kohana 3.3 and followed the instructions (creating a mysqli folder in the modules folder and adding a new line in bootstrap.php to enable it).

However when I try to perform any database actions it still says it's using MySQL. The error reads: "Database_Exception [ 8192 ]: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead".

The line I'm using to enable the module is 'mysqli' => MODPATH.'mysqli', // MySQLi support for Kohana

The MySQLi driver I'm using is this (links to github).

Can anyone see what's going wrong?

Thanks in advance.

解决方案

Just enabling the module isn't enough.

Since Kohana 3.3 the autoloader is case sensitive, so MODPATH/mysqli/classes/kohana/database/mysqli.php should become MODPATH/mysqli/classes/Kohana/Database/MySQLi.php for example.

You have to edit your APPPATH/config/database.php and set the driver to 'MySQLi' or set Database::$default to the correct default database instance name. (The one using 'MySQLi' as the driver.)

And just to be sure, do NOT edit config files outside of APPPATH. Instead, copy the file to APPPATH and edit that file. You generally should not have to edit files outside of APPPATH. Updating modules to work with a new version is allowed of course. But config files outside of APPPATH should serve as examples/blueprints.

这篇关于Kohana 3.3不使用MySQLi驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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