Home > php_mysql > UTF-8 and apache – mysql – php

UTF-8 and apache – mysql – php

December 16th, 2009 Leave a comment Go to comments

Settings a LAMP server to work in full unicode UTF-8 :

httpd.conf:

AddCharset UTF-8 .utf8
AddDefaultCharset UTF-8

php.ini

default_charset = "utf-8"

my.cnf

character-set-server=utf8 default-collation=utf8_unicode_ci

In all your PHP scripts :

mysql_query("SET NAMES 'utf8';",$con);

Importing database :

mysql -h host -u username -p password --default_character_set utf8 database < file.sql

Dont forget to add UTF-8 in the head of all your HTML files :

<meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;/>

Categories: php_mysql Tags:
  1. No comments yet.
  1. No trackbacks yet.

17042 pages viewed, 0 today
11074 visits, 0 today
FireStats icon Powered by FireStats