Search code examples
php.htaccessaspellpspell

How can I test pspell?


This was working fine then I switched to the cpanel with godaddy. If I run a test with my php info its says that pspell is enabled. Does anyone know of a way to test for errors, or even possibly a fix?

$pspell_config = pspell_config_create("en");
pspell_config_personal($pspell_config, "/home/user/public_html/custom.pws");
pspell_config_repl($pspell_config, "/home/user/public_html/custom.repl");
$pspell_link = pspell_new_config($pspell_config);

I am testing my code already with the code below.. This lets me know if it works or not but doesn't throw errors!

$pspell_link = pspell_new("en");
$word = "color";
if (pspell_check($pspell_link, $word)) {
echo "Found a fix.";
} else {
echo "Sorry we are working on our search engines, please bare with us!";
}

Solution

  • I found this code to do the trick.

    error_reporting(E_ALL);
    @ini_set('display_errors', 1);
    
    // Call it once first because of a bug in Windows' Aspell.
    pspell_new('en');
    
    $test = pspell_new('en');
    
    echo '
       Testing pspell.... ', pspell_check($test, 'thisisnotawordandyouknowit') ? 'failure' : 'pass', '.<br />
       If no error messages were displayed, Aspell is installed and working properly.';
    

    this display errors for pspell without the need for running error checking through the php.ini