0

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.

1
  • Are you using modules mysqli and database at the same time? I think this should not be declared as a module but rather as a driver in your DB module
    – kero
    Oct 31, 2013 at 16:36

2 Answers 2

6

I've bumped into this issue as well.

The problem has been discussed on the Kohana forums. The next version (3.4) will include changes to the Kohana Database module so you can use the MySQLi library.

Until then I've disabled deprecated errors appearing by changing the error_reporting in index.php

error_reporting(E_ALL & ~E_DEPRECATED);

Hope this helps

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.