My picCerberus, as many of you might know, is a helpdesk platfrom developed in PHP and MySQL. It is a very good solution in the market for this kind of job. But there are many dependencies and some problems you should be aware of before installing. A big problem with cerb4 is encodings. It is written to natively support the ISO-8859-1 character set. This means that in order to make it work you need to dig into the code a little bit to set it up correctly.

Before we dig into the encoding problem we firstly need to setup the system first. Intsalling is a bit tricky due to the requirements the system has. A default LAMP installation just won’t do the trick. You need two extra modules except for the standard ones. The mailparse and the mbstring module. If you make a debian based install then an apt-get will do the trick for both. The hard case is when you want to install apache and php from source. For mbstring you need to add the flag “–enable-mbstring” when configuring php for build.

The tricky one is mailparse. This one i did not make it to install it at all. All seemed disapointing when i read cerb4’s wiki and the solution about a php package developed by a community member called mailparse2em which actually emulates the mailparse php extension on the php side. It might be slower than a C module loaded on the PHP core but hey, if you make it and install mailparse please tell me step by step how you did it. You can read more about mailparse2em on cerb4 wiki here.

By now, you should have cerb4 installed on your server. If not, then definitely leave a comment. Everything should be working fine except for the encodings. If you intend to use the helpdesk for English speaking-writing customers then you should be fine. If not then you need to add the support for the foreign encodings. To do this you need to convert your database to UTF-8 (instead of latin which the default installation uses) and then tweak the code little bit. The thread in the forum of cerb4 that i got the valuable info is this. The most valuable post is that of “reogerger” which i quote here:

1. Install Cerberus (you must be done with that one by now…)
2. Convert the database to utf-8 (I’m using mysql)

mysqldump -u root -p -h localhost cerb –default-character-set=utf8 > cerb-db.sql
cat cerb-db.sql | sed ‘s/latin1/utf8/g’ > cerb-db-utf8.sql

3. Drop the old database
4. Create a new database using default encoding utf8_unicode_ci
5. Import the cerb-db-utf8.sql to the new database

6. Modify Parser.php (I got the Revision 556)
The lines

from
$text = mb_convert_encoding($text, “ISO-8859-1”, $info[‘content-charset’]);
to
$text = mb_convert_encoding($text, “UTF-8″, $info[‘content-charset’]);

$out .= mb_convert_encoding($part->text,”ISO-8859-1″,$charset);
$out .= mb_convert_encoding($part->text,”UTF-8”,$charset);

7. Edit your php.ini and add the following
mbstring.internal_encoding=UTF-8

At this point you should be able to see the correct characters showing in cerberus

PS: To debug smarty template. you need to have debug.tpl in your smarty library directory, and modify the debug setting in Smarty Class File.

8. For foreign multi-byte issues. You need to edit the template files and get rid of the escape filter. (You could tell which templates get loaded by using the debug.tpl)

Let me clarify a few things here, which i triped on my self. First of all, in step six, all you need to do is find the mb_convert_encoding calls and change them accoringly. I modified rogerger’s suggestion as follows:

$text = mb_convert_encoding($text, "UTF-8", $info['content-charset']);

to

$text = mb_convert_encoding($text, "UTF-8", array($info['content-charset'], 'ISO-8859-1', 'ISO-8859-7'));

Essentialy, what i do is cover my back for the case that the mailing program uses, instead of the character code set, auto. The header sent with the email would look like “Character-Set: auto”. By adding my expected encodings to the array that mb_convert_encoding accepts i make sure that the character encodings will be converted correctly.

One more thing is the point numbered 8. This is a very crucial one, one that i ignored completely and had to trouble the forum again with a question. So, pay attention to it. The user, rogerger, says we need to get rid of the escape character in the template files. Hildy, clarifies this on a next post. What you need to do is remove any occurance of the “|escape[:htmlall]” from all the tpl files. To do that, as rogerger suggests, you need to enable debugging mode on smarty (file libs\devblocks\libs\smarty\Smarty.class) and copy the debug file of smarty (you can download it here). When you do this, you must be able to see all the characters rendered correctly on your new cerberus helpdesk.

This post intends to just summarize my experience on installing cerb4 on a server. I would like to thank the community of cerberus, especially rogerger and hildy. For any problems, inaccuracies, suggestions etc i would be glad to see a comment. Hope i helped!