Do Not Upgrade Your WordPress wp-config.php

ADVERTISEMENTS

Whenever you install WordPress on a blog, you will need to modify the wp-config.php file to define the WordPress configuration settings required to access your MySQL database. However, you will not need to modify the file whenever you do a WordPress upgrade.

Recently I have been seeing strange characters appearing on many of my posts and some of the pages on this blog. I tried many things but could not find out the reason for this. Yesterday after reading this post on QuickOnlineTips, I realized the reason why I was seeing the strange characters. During a recent WordPress upgrade I had upgraded my wp-config.php file too as I had seen some new additions to it.

This is what I found added to the new wp-config file

define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

Since WordPress Version 2.2, DB_CHARSET was made available to allow designation of the database character set to be used when defining the MySQL database tables.

Warning for those performing upgrades: If DB_CHARSET and DB_COLLATE do not exist in your wp-config.php file, DO NOT add either definition to your wp-config.php file unless you read and understand Converting Database Character Sets. Adding DB_CHARSET and DB_COLLATE to the wp-config.php file, for an existing blog, can cause problems — as Ryan Boren says, “your queries will go boom!”

source: Editing_wp-config.php

Since I had already added the two definitions to my wp-config.php file, I just commented it out and the strange characters seem to have gone :)

Have you upgraded your wp-config.php file and experienced the same problem?

banner

Search JohnTP.com or view a random post

To receive this blogs articles for FREE on your email inbox, just enter your email address below and click 'Go':

Enter your email address: or .

Find out what I am doing currently by .

5 responses so far, Leave a comment

  1. 1

    Ronald Huereca

    November 20, 2007 at 6:24 am

    I ran into the problem locally when I did a fresh 2.31 install and was testing out my Ajax Edit Comments plugin with various charsets. I couldn’t for the life of me figure it out and finally came across a few posts telling me to leave the charset empty.

    I’d imagine this charset will only help out a minority of bloggers. I think WP goofed by giving it a default value.

  2. 2

    Jude

    November 20, 2007 at 2:07 pm

    This is something I don’t understand though, why do you need to upgrade your wp-config.php? Usually you’ll just replace every other files apart from wp-config for an upgrade. No?

  3. 3

    JohnTP

    November 20, 2007 at 4:42 pm

    Jude- You don’t need to upgrade your wp-config.php file

  4. 4

    Madhur Kapoor

    November 20, 2007 at 8:45 pm

    I have never ever touched my wp-config file.

Have something to say?




Copyright ©2005-2008 JohnTP, All rights reserved.