Page 1 of 1

utf problem on different PHP/APACHE?

Posted: Wed Aug 02, 2006 9:31 am
by m0n
Hello Guys!

I have dev environment with IIS, PHP 4 and MySQL 5 server set with UTF8 encoding.
When i fetch data using PHP in this environment everething fine and I get utf characters displayed fine.

Then I move PHP file (which is fetching data) to another server with APACHE 2.2/PHP 5 on it. Database stays the same (located at my environment.)
BUT all characters displayed as "?" (question marks). Not even screwed up characters but really only question marks.

This makes me belive that problem is not in MySQL but probably in PHP or APACHE on second server?

I've tested fetching data on 4 servers it total. Results are (remember DB is the same):

IIS 5/PHP 4: OK;
Apache 1.3/PHP 4: OK;

Apache 2.2/PHP 5: NOT working;
Apache 2.0/PHP 4 NOT working.

Problem that webapplication will be hosted on "bad" server...

Your help will be very appreciated.
Cheers

Solution

Posted: Thu Aug 03, 2006 3:05 am
by m0n
Hi
I found solution:

use

Code: Select all

mysql_query("SET NAMES utf8");
right after opening connection.

I hope this helps avoid headaches as I had for 2 days
:wink: