Spell Checking in PHP

i need a code for spell checking using php, i have not done any thing like this before, i found a lot of information on net,, plus i also found a simple code, that i require,, but now i am having problem running it. i read some where that the pspell can only be used in linux environment. i dont have linux so i uploaded it to the server but still i am getting the error "Fatal error: Call to undefined function: pspell_new() in /home/discrete/public_html/kbase/spell.php".
this is the part of code i am using,,

      $misspelled = array();
      $suggestions = array();
      $original = $text;
      $words = preg_split ("/[\s,.]+/", $text);
      $pl = pspell_new ("en");
      foreach($words as $key=>$word)
            $checkword = preg_replace("/[^A-z-']/", '', $word);
            if (!pspell_check ($pl, $checkword))
                  $misspelled[$key] = $checkword;
                  $suggestions[$checkword] = pspell_suggest ($pl, $checkword);

can anyone help me,,,
its urgent
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Marcus BointonConnect With a Mentor Commented:
You probably just need to configure PHP with --with-pspell and recompile it. This is easy on *nix, but difficult on Windows. There are some comments on how to do it here:


I see that on Windows it's mapped to aspell, which I assume is a pspell workalike.
SadafRasheedAuthor Commented:
thanks for the reply,,
i read that document and tried the code provided on te page but i am getting this message
"Warning: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en". in C:\Apache2\htdocs\kbase\try.php on line 11"
the code is

  $str="This is a test for the spell checker function";      
  $ret = spellcheck($str);

function spellcheck ( $string )
   $words = preg_split('/[\W]+?/',$string);
   $misspelled = $return = array();
   $int = pspell_new("en");
   foreach ($words as $value)
       if (!pspell_check($int, $value))
           $misspelled[] = $value;
   foreach ($misspelled as $value)
       $return[$value] = pspell_suggest($int, $value);
   return $return;
i guess the pspell extension is working because i am not getting any undefined function errors
so, now what :$
what am i doing wrong and what should i do to rectify this,,,
waiting for reply,,,
Marcus BointonCommented:
It just sounds like you have not installed the dictionaries where it expects to find them. The user notes have a comment about how and where to instal them - did you try that?
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

SadafRasheedAuthor Commented:
i have,,, well i think,,
when i have installed the two exe, one for aspell and other for the dictionary,,
when i run aspell from dos, it works fine,,, one thing i have to go to program files/aspell/bin,,, i doesnot pick the path automatically,, do i have to give the path of dictionary in the autoexec.bat or some thing like that???
also the main server where i'll finally have to run it is running linux,,, and i dont know the path of dictionary,, is there any method to get that info...

Marcus BointonCommented:
Perhaps you should check this out, and perhaps some of the other docs on pspell?

Dipak SolankiCommented:
I have installed pspell on my wamp2.4 and php5.4.16 on my windows server. I have enable dll in php.ini and also place in system32. When I run my php page I got fatal error "Fatal error: Call to undefined function pspell_new()  in php file".

Please suggest or let us know what will be missing to run file.
Dipak SolankiCommented:
sphinxsearch extension not working in my wamp2.4 and php5.4 (windows server). I have followed the all steps as mention in below link. Please let us know how to make it working.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.