Welcome Guest, Not a member yet? Register   Sign In
CI 1.6 and MySQL 4.0 Character Set and Collation

Hi folks,

I just installed (fresh, not upgraded) to CI 1.6 using a MySQL 4.0 installation, and I'm having problems connecting to the DB. Specifically
in regards to the new parameters in /config/database.php:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
I get this error:
Quote:An Error Was Encountered
Unable to set client connection character set: utf8

I know that MYSQL 4.0 bunches the character set and the collation into 1 entity, and I'm assuming CI is handling the connection/setting character set for versions > 4.1. Honestly I'm not even sure what to ask here, I just need some help to be pointed in the right direction. HELP!


[eluser]Sean Murphy[/eluser]
Character sets and collation were added in MySQL 4.1. They won't work in 4.0.

Correct -- So i'm assuming I'd have to do a bit of modding to use CI 1.6 with MySQL 4.0 -- or does anyone w/ a good amount of knowledge behind the inner workings of how character sets are used in CI 1.6 , and if it would be feasible to do so (remove the mentions of character sets throughout the database class) Thanks!

[eluser]Derek Allard[/eluser]
in your database.php, try setting your $db['default']['dbcollat'] to TRUE

No luck there either.

[eluser]Derek Allard[/eluser]
Sorry, I'm not sure what I was thinking. You know how sometimes your fingers are moving, and you know what you want to say... but something totally different comes out?

Do this. Open up system/database/drivers/your_driver/your_driver.php Find the db_set_charset() function, in my MySQL driver this is around line 95. Change it to say
function db_set_charset($charset, $collation)
        return TRUE;

[eluser]Derek Jones[/eluser]
Please see my response to this bug report thread, and the posts prior to it for a solution for a temporary work around until you are able to find a server that meet's CodeIgniter 1.6's requirements for MySQL.

Edit: I went to get my mail and I see Derek Allard has replied. My link here is still relevant though as it pertains to CI's new MySQL requirements.

Excellent -- thanks gentlemen

I've added a quick and dirty wiki entry found at:


[eluser]Derek Jones[/eluser]
Thank you for your contribution, lookatthosemoose, I'm sure other MySQL 4.0 users will appreciate it.

Theme © iAndrew 2016 - Forum software by © MyBB