Pspell setup


(Adam Last) #1

I've compiled and installed the aspell package.
I've compiled php with --with-pspell

I've compiled and installed the english dictionary which I think has put itself in /usr/local/lib/aspell



I've rerun the installation program to reconfigure matrix but now when I try to use the spell checker I keep on getting all the words reported as wrong and the error message in the log:



[Tue Jul 6 14:02:59 2004] [error] PHP Warning: 0 is not a PSPELL result index in /usr/local/apache/htdocs/matrix/fudge/wysiwyg/plugins/spell_checker/spell_parser.inc on line 103



Plus a tiny php script which uses the pspell functionality creates the error message

[Tue Jul 6 14:12:55 2004] [error] PHP Warning: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en". in /usr/local/apache/htdocs/testphp.php on line 4



I'm just not sure how to point the aspell in php at the data dictionary


(Marcus Nyeholt) #2

Make sure in your testphp.php file you’ve made a call to pspell_new(‘en’) to load a dictionary first


http://au2.php.net/manual/en/function.pspell-new.php


(Rodney Amato) #3

Last time I got this error was because I had assumed installing aspell would install a dictionary along with it - which it didn’t. You probablly want to verify that a dictionary is indeed installed. It looks like it is a seperate package on the site too see ftp://alpha.gnu.org/gnu/aspell/dict/en/


(Adam Last) #4

Script is below:


<?php



$pspell_link = pspell_new("en");

$word = "color";

if (pspell_check($pspell_link, $word)) {

echo "This is a valid spelling";

} else {

echo "Sorry $word is spelt wrong";

}



?>



and running aspell dump dicts gives:



[termite|root|196] aspell dump dicts

en

en_CA

en_CA-w-accents

en_GB

en_GB-w-accents

en_US

en_US-w-accents



I'm not sure if the pspell module in php knows where these directories are installed??


(Rodney Amato) #5

Did you compile php after installing aspell and point php to the right place when you compiled it ? Maybe the php install found other compatible headers when you compiled it ?


(Adam Last) #6

I've just determined it was a permissions problem on the directory /usr/local/lib/aspell which was not readable or browseable by everyone.


A good test for this is to run



aspell -c filename.txt



This should run check the spelling of the words in filename.txt. If you can't run it as a non-priviledged user then you've got a problem.



The spell checker now works well and loks really professional.



Adam


(Avi Miller) #7

Its obviously not working on the forum, though. :lol:


(Tim) #8

Guys, I got the same error but with another sircumstances.


First of all I'm trying to setup PSPELL under Win32 (W98SE). I have Apache 1.3.3 and php 4.3.8



Here are my steps:


  • add this line to php.ini



    extension=php_pspell.dll


  • install aspell 0.50.3.3
  • install aspell-en 0.50.2.3
  • copy files (aspell-15.dll and pspell-15.dll) to c:\w98\system\



    Here what i got:



    PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".





    I think that php don't see the dictionary and i don't know how to point it.



    Please help. Thanks in advance.