Bug #18347 Connecting from PHP results into "Can't initialize character set"
Submitted: 20 Mar 2006 1:09 Modified: 22 Apr 2006 13:33
Reporter: [ name withheld ] Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.19 OS:FreeBSD (FreeBSD 6.1)
Assigned to: CPU Architecture:Any

[20 Mar 2006 1:09] [ name withheld ]
Description:
When I try to connect to MySQL server in PHP (via mysql or mysqli), every time I get response:

Can't initialize character set cp1250 (path: /usr/local/share/mysql/charsets/) 

But in mentioned path there are definitelly character sets including Index.xml and MySQL is compilet with --with-charset=cp1250 and --with-extra-charsets=complex (tried also --with-extra-charsets=all, but no difference).

Connecting with mysql client and proftpd's mod_sql works fine.

How to repeat:
Install MySQL 5.0.19 on FreeBSD from ports, also install Apache 2.0 and PHP 5.1.2 and try connect to MySQL by this simple php command:

$MySQL_spojeni = MySQL_Connect("ip.address", "user", "pass");

as result you will get

Warning: mysql_connect() [function.mysql-connect]: Can't initialize character set cp1250 (path: /usr/local/share/mysql/charsets/)

Used settings for MySQL port:
WITH_CHARSET=cp1250
WITH_XCHARSET=all
WITH_COLLATION=cp1250_czech_cs
BUILD_OPTIMIZED=yes
WITH_ARCHIVE=yes

Setting for PHP port:
WITHOUT_DEBUG=true
WITHOUT_MULTIBYTE=true
WITHOUT_IPV6=true

Settings for PHP port:
WITHOUT_BCMATH=true
WITH_BZ2=true
WITH_CALENDAR=true
WITH_CTYPE=true
WITH_CURL=true
WITHOUT_DBA=true
WITHOUT_DBASE=true
WITHOUT_DOM=true
WITH_EXIF=true
WITH_FILEINFO=true
WITHOUT_FILEPRO=true
WITHOUT_FRIBIDI=true
WITH_FTP=true
WITH_GD=true
WITH_GETTEXT=true
WITHOUT_GMP=true
WITH_ICONV=true
WITH_IMAGICK=true
WITH_IMAP=true
WITHOUT_INTERBASE=true
WITHOUT_LDAP=true
WITH_MBSTRING=true
WITH_MCRYPT=true
WITH_MHASH=true
WITHOUT_MING=true
WITHOUT_MSSQL=true
WITH_MYSQL=true
WITH_MYSQLI=true
WITHOUT_NCURSES=true
WITHOUT_ODBC=true
WITH_OPENSSL=true
WITHOUT_PANDA=true
WITHOUT_PCNTL=true
WITH_PCRE=true
WITH_PDF=true
WITHOUT_PGSQL=true
WITH_POSIX=true
WITH_PSPELL=true
WITHOUT_READLINE=true
WITHOUT_RECODE=true
WITH_SESSION=true
WITHOUT_SHMOP=true
WITH_SIMPLEXML=true
WITHOUT_SNMP=true
WITHOUT_SOAP=true
WITHOUT_SOCKETS=true
WITH_SQLITE=true
WITHOUT_SYBASE_CT=true
WITH_SYSVMSG=true
WITH_SYSVSEM=true
WITH_SYSVSHM=true
WITHOUT_TIDY=true
WITH_TOKENIZER=true
WITHOUT_WDDX=true
WITH_XML=true
WITH_XMLREADER=true
WITHOUT_XMLRPC=true
WITH_XMLWRITER=true
WITHOUT_XSL=true
WITHOUT_YAZ=true
WITH_ZIP=true
WITH_ZLIB=true

Suggested fix:
dunno
[22 Mar 2006 13:33] Valeriy Kravchuk
Thank you for a problem report. What version(s) of libmysqlclient library do you have? Is it possible for you to install and check with MySQL official binaries?
[22 Apr 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".