FCKeditor is an excellent tool for providing rich text editing experience on web. Best part is that it works almost out of the box, there is very little to configure. Spelling checking is an exception here. Though spell checking also works out of the box, but with Internet Explorer only, which is not the only browser out there. Recently I used FCKeditor in a Java web application and had to integrate the spell check functionality as well. The spellar pages + aspell + PHP combination works pretty well for this task. FCKeditor comes with perl, PHP and Cold Fusion scripts for spell checking, I used PHP. In this post I will try to outline the steps required to make spell check working in FCKeditor.
1. Install PHP
PHP installation (I did it on Fedora) is pretty simple, just download the source and execute following command sequence-
tar –xvzf php-5.2.9.tar.gzFor more details about PHP installation see PHP documentation.
./configure --prefix=/path_to_install \
2. Integrate PHP with Apache
Apache needs to be instructed to invoke PHP interpreter for all requests for PHP files ('.php' extension). First we need to include PHP module by adding following line in /apache_install_dir/conf/httpd.conf-
LoadModule php5_module modules/libphp5.soIn same configuration file add PHP handler-
<Directory "/apache_install_dir/htdocs">3. Install aspell and dictionaries
. . . .
. . . .
<FilesMatch \.php$ >
Aspell provides dictionaries for all major world languages. Installation of aspell and its dictionaries is fairly straightforward. After downloading aspell and dictionaries execute following command sequence for each of the downloaded archive-
tar –xvzf archive_name.tar.gz4. FCKeditor Configuration
By default FCKeditor is configured to use 'ieSpell', change it to use 'SpellarPages' instead. Also make sure it uses PHP and does spell checking in FireFox. Following properties needs to be changed in 'fckconfig.js'-
FCKConfig.SpellChecker = 'SpellerPages' ;Now configure the language and 'aspell' path in 'spellchecker.php'-
FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ;
FCKConfig.FirefoxSpellChecker = true ;
$aspell_prog = 'aspell';
$lang = 'en_US';
Now we are ready to test the application and see spell check in action. All software versions being used for this post are outlined below-
- Apache 2.2.11
- PHP 5.2.9
- FCKeditor 2.6.4 (with bundled Spellar Pages)
- Aspell 0.60.6
- Tomcat 6.0.18
- Java 6 update 13
- Fedora 9