Switch Roundcube to Use Local Spellcheck Engine

Mindwatering Incorporated

Author: Tripp W Black

Created: 04/04 at 10:34 PM

 

Category:
Linux
Configuration

Task:
For either privacy reasons, or because the cloud-based spellcheck is down/not available, there is an interest in switching Roundcube to the local installed "pspell" spellchecking engine.


Steps:
1. Login to the server via SSH or local console, and confirm the current settings in /etc/roundcube/defaults.inc.php.
Note the sections in red below. It is likely you are reading this post because spellchecking is enabled and sending email is broken when the cloud-based spellchecker is offline.
It can also be forced off-line, if you lock down the referrer/external AJAX too much for the Roundcube client to talk to the external server.

$ sudo vi /etc/roundcube/defaults.inc.php
...
// Enables spellchecker exceptions dictionary.
// Setting it to 'shared' will make the dictionary shared by all users.
$config['spellcheck_dictionary'] = true;

// Set the spell checking engine. Possible values:
// - 'googie' - the default (also used for connecting to Nox Spell Server, see 'spellcheck_uri' setting)
// - 'pspell' - requires the PHP Pspell module and aspell installed
// - 'enchant' - requires the PHP Enchant module
// - 'atd' - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
// Since Google shut down their public spell checking service, the default settings
// connect to http://spell.roundcube.net which is a hosted service provided by Roundcube.
// You can connect to any other googie-compliant service by setting 'spellcheck_uri' accordingly.
$config['spellcheck_engine'] = 'googie';

// For locally installed Nox Spell Server or After the Deadline services,
// please specify the URI to call it.
// Get Nox Spell Server from http://orangoo.com/labs/?page_id=72 or
// the After the Deadline package from http://www.afterthedeadline.com.
// Leave empty to use the public API of service.afterthedeadline.com
$config['spellcheck_uri'] = '';

2. Install the pspell PHP package:
$ sudo apt-get install php-pspell
...
The following additional packages will be installed:
aspell aspell-en dictionaries-common emacsen-common libaspell15 php8.3-pspell
Suggested packages:
aspell-doc spellutils wordlist
The following NEW packages will be installed:
aspell aspell-en dictionaries-common emacsen-common libaspell15 php-pspell php8.3-pspell

Notes:
- In our case, a couple other libraries/packages were installed via "installing additional unselected".
- The auto-triggers also auto-refreshed the php service w/in apache2, so we did not need to manually restart the php service.

3. Update the /etc/roundcube/defaults.inc.php configuration file for Roundcube. Change the following lines:
$config['spellcheck_engine'] = 'pspell';
$config['spellcheck_uri'] = '';

Note:
In our case, the spellcheck was already enabled, and the URL was empty, using default, so we only had the one engine line to change.

$ sudo vi /etc/roundcube/defaults.inc.php
...
$config['spellcheck_engine'] = 'pspell';
...

Save:
<esc>:wq


4. Send a test email as a user.
a. Change Preferences for user to check spelling:
Roundcube --> Settings --> Under Section heading. click Composing Messages --> Under Spellcheck Options heading, enable checkbox Check spelling before sending a message. Click Save.

b. Send a test email.



previous page