The cPanel Reseller Server Upgrade & Encoding July 22nd, 2009

As you’ve probably been notified of by now, Idologic is upgrading its cPanel Reseller servers. A major component of this upgrade was the switch from PHP4 (End of Life) to PHP 5.2.10 as the default server choice. This change resulted in a change in the default encoding for PHP which affected websites that might employ encoding other than the UTF-8 character set.

Arriving at the issue, some websites – in particular those dealing with languages other than English – have some problems with the new default configuration that will result in a lack of proper character display. A symptom of this is very strange characters in your website content such as “?” and other odd and funky symbols. To alleviate this issue, there are a few directives required for .htaccess and php.ini.

The first step is to drop the following line into the .htaccess to tell PHP where to look for the php.ini file it will use:

suPHP_ConfigPath /home/username/public_html/

Note: You need to replace username with your account username. For example, if your account name is denver, you would use the path: /home/denver/public_html/.

Now, we need to add some lines to php.ini to tell PHP how to handle the output:


mbstring.language = Neutral ; Set default language to Neutral(UTF-8) (default)
mbstring.internal_encoding = iso-8859-1; Set default internal encoding to UTF-8
mbstring.encoding_translation = On ; HTTP input encoding translation is enabled
mbstring.http_input = auto ; Set HTTP input character set dectection to auto
mbstring.http_output = iso-8859-1;
mbstring.detect_order = auto ; Set default character encoding detection order to auto
mbstring.substitute_character = none ; Do not print invalid characters
default_charset = iso-8859-1; Default character set for auto content type header

Note: I used the character set ISO-8859-1 above, but your specific character set in these lines will depend upon what character set you use on your website. For a helpful hint, try looking at your meta tags in your website’s source code to see if any special encoding is used. You would then want those ISO numbers to match. Replace ISO-8859-1 with UTF-8 as an example.

This is where it can get a little tricky. Some websites might display one content type in the front, and change to another in the backend (such as an administration area). To work with this, we need to tweak the php.ini lines slightly:


mbstring.language = Neutral ; Set default language to Neutral(UTF-8) (default)
mbstring.internal_encoding = iso-8859-7 ; Set default internal encoding to UTF-8
;mbstring.encoding_translation = On ; HTTP input encoding translation is enabled
mbstring.http_input = auto ; Set HTTP input character set dectection to auto
mbstring.http_output = auto;
mbstring.detect_order = auto ; Set default character encoding detection order to auto
mbstring.substitute_character = none ; Do not print invalid characters
default_charset = auto; Default character set for auto content type header

Note: See how mbstring.encoding_translation is commented out.

This should do the trick and get your website displaying as it should. I do recognize that this can be a little tricky to very tricky. As always, Idologic is available 24/7 x 365 at our helpdesk, so head on over there if you need help.

If you want more technical information, here are some helpful links.

PHP Manual: http://us2.php.net/manual/en/mbstring.configuration.php
UTF-8 Cheatsheet: http://developer.loftdigital.com/blog/php-utf-8-cheatsheet

Leave a Reply

Your email address will not be published. Required fields are marked *