Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-25-2006, 08:32 AM   #1
LQ Newbie
Registered: Oct 2005
Posts: 3

Rep: Reputation: 0
Apache2, PHP5, MySQL and charset issue

Hi all,

I installed a complete LAMP on my computer and I have some trouble with the charset.
In MySql, I have a database with utf-8 characters.
I have a website on the localhost where every PHP page is encoded in utf-8 too. The HTML header specifies that the page is encoded in utf-8.

When I access the website from my web browser, all the characters look normal. But when I request some data from the MySql database, all the special characters ( ...) are replaced with some strange character.
If I fill a form on my website with special characters and that I save this entry into my Mysql database, I get strange characters in my database too (but not the same).

I tried to set every default characterset as utf-8 wherever I could in PHP, Apache2 and MySql configuration files, without any success.

What should I do?

Thanks for any help,

- Emmanuel
Old 06-26-2006, 03:28 AM   #2
Registered: Aug 2003
Location: Montpellier, France, Europe, World, Solar System
Distribution: Debian Sarge, Fedora core 5 (i386 and x86_64)
Posts: 262

Rep: Reputation: 30
which version of mysql are you using ? On newer version (starting 4.1 from memory), character sets/collations can be set in tons of different places: server, client, connection, database, table, column.... I would check that none of these have a value you do not want to use (like latin1), especially at the table or column level. A tool like phpMyAdmin (recent version) could help.
Old 06-26-2006, 04:30 AM   #3
LQ Newbie
Registered: Jun 2006
Location: SLC, UT
Distribution: Ubuntu
Posts: 21

Rep: Reputation: 15
Run "show variables like '%collation%'" at a mysql prompt and hopefully you should see the expected utf value.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 and PHP5 SpiderIRE Linux - Software 3 09-30-2005 03:25 PM
Apache2 and PHP5 rul3r Slackware 7 09-11-2005 05:21 PM
configure php5 and mysql issue jiawj Programming 1 08-17-2005 03:34 PM
Apache2 + PHP5.0.3 24jedi *BSD 1 07-21-2005 03:07 PM
Apache2: Charset and Encoding Problems sarmadys Linux - General 0 11-17-2002 12:11 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration