MySQL Forums
Forum List  »  PHP

FIXED | Charset SESSION vs GLOBAL
Posted by: Cédric Michel
Date: March 25, 2011 03:12PM

Hi all,

Why are the SESSION VARIABLES different from GLOBAL?
I doesn't find any config option for setting defaut SESSION in latin1.

I got a problem with an old server (local server) running many (old) sites. On recent projects, we use SET NAMES (latin1 or utf8) and it works fine.

But for old projects in latin1, we've got a charset issue, even if (I think ?!) all config files (apache, php and mysql) are well configured for latin1 by default.
i.e. /etc/mysql/my.cnf:

[mysqld]
character-set-server   = latin1
default-character-set   = latin1
# Added for test
init-connect                = 'SET NAMES latin1'

The problem doesn't comes from this config file which is well interpreted... but for GLOBAL VARIABLES:

# SHOW GLOBAL VARIABLES like "char%";
character_set_client => latin1
character_set_connection => latin1
character_set_database => latin1
character_set_results => latin1
character_set_server => latin1
character_set_system => utf8
character_sets_dir => /usr/share/mysql/charsets/


# SHOW SESSION VARIABLES like "char%"; 
character_set_client => utf8
character_set_connection => utf8
character_set_database => latin1
character_set_results => utf8
character_set_server => latin1
character_set_system => utf8
character_sets_dir => /usr/share/mysql/charsets/

Site is running on PHP 5.2.2 (CGI/FastCGI). No charset definition in .htaccess.
If I had a .htaccess with AddHandler application/x-httpd-php
=> same error on PHP 4.4.8 (Apache 2.0 Handler)

Of course, tests are made without any local modification like mysql_set_charset (>=PHP 5.2.3), SET NAMES...

mysql_client_encoding (PHP) returns utf8

Any suggestion?

Thanks, Cédric

Options: ReplyQuote


Subject
Written By
Posted
FIXED | Charset SESSION vs GLOBAL
March 25, 2011 03:12PM
March 26, 2011 03:37PM
March 27, 2011 07:17PM
March 28, 2011 12:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.