ID:               45921
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ymagriso at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Windows XP/SP3
 PHP Version:      5.2.6
 New Comment:

IIRC, the SET NAMES doesn't actually do anything with Mysql 5.0 on
client side..I might be wrong though. :)

Check that you really have it, run this in the mysql client:

mysql> SHOW CHARACTER SET;

And check your mysql config (my.cnf or whatever it's called in win32)
that it has the proper path for the charsets. It should be in [mysql]
section. (mysql manual might help? :)


Previous Comments:
------------------------------------------------------------------------

[2008-08-28 18:37:15] ymagriso at gmail dot com

I un-installed PHP, downloaded the PHP installer again from another
mirror and installed again.

However, the version of the client was still 5.0.51a (and I am still
encountering the same problem).

Please, advise whether I am missing something.

------------------------------------------------------------------------

[2008-08-27 08:07:34] ymagriso at gmail dot com

You are right.
phpinfo() shows the following in MySQLi section:

MysqlI Support  enabled
Client API library version      5.0.51a
Client API header version       5.0.51a
MYSQLI_SOCKET   /tmp/mysql.sock

However, I downloaded the library along with the PHP installer from the
following location:
http://il2.php.net/get/php-5.2.6-win32-installer.msi/from/a/mirror

I will try to download it again, re-install and then check whether the
version was updated.

------------------------------------------------------------------------

[2008-08-26 22:29:37] [EMAIL PROTECTED]

Do you by any chance have two different mysql versions installed?
What does phpinfo() have to say in the MySQLi section about which
client lib version is used..?

------------------------------------------------------------------------

[2008-08-26 12:01:30] ymagriso at gmail dot com

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 this bug report at http://bugs.php.net/?id=45921&edit=1

Reply via email to