Krekr Krekr - 6 months ago 86
MySQL Question

kohana db exception [0]

I have a big problem with connecting to mysql database. I tried everything and nothing worked.
If i try to connect on localhost with xampp to db on kohana (3.1.2), i get this error:

Database_Exception [ 0 ]: ~ MODPATH\database\classes\kohana\database\mysql.php [ 67 ]

but if i try run it on some server, it runs there and i dont know why, because everything is same (except db user and password).
I thought that it can be with mysql config, but i dont know what there.

Answer Source

I just came across this problem and figured out what it was so even though this question is old, people having this problem should know the answer.

Basically when you get this error its because your using a version of php 5.5+.

mysql_connect(...) is a depreciated function starting in php 5.5 and above so the call in the framework is wrapped around a try/catch but the output from the catch doesn't give you any details about the error for whatever reason but if you remove the try/catch you'll see the real php error is simple saying mysql_connect is depreciated and will be removed in the future and to use mysqli instead.

To fix this open index.php in your root and basically you need to change the error_reporting(...) call to tell it not to error on depreciation errors which you can do like so to report all errors except warnings and deprecations.

error_reporting(E_ALL ^ (E_WARNING | E_DEPRECATED));

Another fix is to change your database config file to connect via PDO instead of mysql.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download