Have you tried MySQLTuner yet? It's free and it makes optimizing your MySQL server easier than ever!

By default, Red Hat Enterprise Linux 4 sets the default character set in Apache to UTF-8. Your specific web application may need for the character set to be set to a different value, and the change can be made fairly easily. Here’s an example where the character set is changed to ISO-8859-1:

First, adjust the AddDefaultCharset directive in /etc/httpd/conf/httpd.conf:

#AddDefaultCharset UTF-8
AddDefaultCharset ISO-8859-1

Then, reload Apache and check your headers:

# /etc/init.d/httpd reload
# curl -I localhost
HTTP/1.1 403 Forbidden
Date: Thu, 08 Nov 2007 22:18:14 GMT
Server: Apache/2.0.52 (Red Hat)
Accept-Ranges: bytes
Content-Length: 3985
Connection: close
Content-Type: text/html; charset=ISO-8859-1

This was tested on Red Hat Enterprise Linux 4 Update 5

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis
One Response to “Change the default Apache character set”
  1. this was done because of the issues with MySQL within RHEL4 prior to that update.

    See:

    https://wiki.intra.rackspace.com/kwiki/index.cgi?MySQLhttpCharacterConfig

    Basically MySQLs global.character_set_results was ISO-8859-1 whereas httpd was UTF-8

    RHEL3, 2.1 and whatever else is ISO-8859-1 for httpd.

    Basically the website page encoding (if not set, AddDefaultCharset in httpd.conf) MUST match character_set_results for MySQL!!!!

Leave a Reply

You must be logged in to post a comment. Login »