From: ymagriso at gmail dot com
Operating system: Windows XP/SP3
PHP version: 5.2.6
PHP Bug Type: MySQLi related
Bug description: Can't initialize character set hebrew (path:
C:\mysql\\share\charsets\)
Description:
------------
I have Apache 2.2.9/PHP 5.2.6 and MySQL 5.0.67 installed on Windows
XP/SP3.
Apache is installed in the following path: "C:\Apache2.2".
PHP is installed in the following path: "C:\PHP5".
MySQL is installed in the following path: "C:\MySQL5.0".
I am running the PHP script below and getting the error specified below. I
could not find anywhere in the documentation how to troubleshoot this
error.
Note, that when I connect with mysql as a client and check the
"character_sets_dir" it shows the correct one:
mysql> show variables like "%character%";
+--------------------------+-----------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | C:\MySQL5.0\share\charsets\ |
+--------------------------+-----------------------------+
8 rows in set (0.00 sec)
mysql>
Therefore, I assume that the problem is not related to MySQL
configuration, but to "MySQLi". However, the documentation does not show
how to change the "character_sets_dir" for MySQLi.
(Also, the documentation advises:
"Note: This is the preferred way to change the charset. Using
mysqli::query() to execute SET NAMES .. is not reccomended."
However, SET NAMES works fine as a workaround to the problem.)
Reproduce code:
---------------
$db = new mysqli('host', 'username', 'password', 'database');
if(mysqli_connect_errno())
{
printf("Error: could not connect to database! Please try again
later.\n");
return;
}
if(!$db->set_charset("hebrew"))
{
printf("Error: could not load character set hebrew - %s\n", $db->error);
}
Expected result:
----------------
Character set of DB is changed to "hebrew" (and no error is shown).
Actual result:
--------------
I am getting the following error message:
"Error: could not load character set hebrew - Can't initialize character
set hebrew (path: C:\mysql\\share\charsets\)"
--
Edit bug report at http://bugs.php.net/?id=45921&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45921&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45921&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45921&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45921&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45921&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45921&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45921&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45921&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45921&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45921&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45921&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45921&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45921&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45921&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45921&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45921&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45921&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45921&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45921&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45921&r=mysqlcfg