'Illegal mix of collations' with PHP 4.3.10 and MySQL 4.1.7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have noticed a very peculiar behavior when I upgraded my PHP
revision from 4.3.9 to 4.3.10 (I use Debian Linux). Suddenly,
the PHP MySQL client stopped accepting the default encoding / collation
when connecting to the server. When issuing any query containing text
field comparisons, I get the following error message:

Illegal mix of collations (latin2_general_ci,IMPLICIT) and
(latin1_swedish_ci,COERCIBLE) for operation '='

The appropriate values when using mysqladmin to check the variables
are as follows:

| character_set_client            | latin2
| character_set_connection        | latin2
| character_set_database          | latin2
| character_set_results           | latin2
| character_set_server            | latin2
| collation_connection            | latin2_general_ci
| collation_database              | latin2_general_ci
| collation_server                | latin2_general_ci

All the tables are converted to the latin2 charset, all the relevant
columns have "latin2_general_ci" set as the default collation.

The following entry in the my.cnf file also doesn't help:

[client]
character_set   = latin2

The webserver is set to use ISO-8859-2 (latin2) as the base charset:
AddDefaultCharset iso-8859-2

The appropriate php packages are version 4.3.10-1 from dotdeb.org.
The libmysqlclient package is version 4.1.7-1 from the same source.
Same goes for the mysql-server package.

This problem has appeared only when migrating from PHP 4.3.9 to
4.3.10, before that everything worked fine. I have partially remedied
the problem by putting the 3 queries:

set names latin2;
set character set latin2;
set collation_connection='latin2_general_ci';

after the initializing code of every MySQL connection I make. However,
since I host multiple sites on the server and possibly have multiple
PHP applications that use SQL client connections, I cannot use this as
a final solution. Downgrading is also not a good option because I
cannot find the old .deb packages anywhere (besides, it might be
caused by some bizarre change done to the configuration file by the
4.3.10 preinstall script, but I've done a quite thorough search
through the config files and found naught). Do you perhaps know how
would I be able to 'force' the PHP MySQL client to accept the latin2
encoding as default?

-- 
Greetings,
Piotr Wilkin
pwl@xxxxxxxxxxxx       PGP key: http://pwl.yz.pl/pwlpgp.txt

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux