hi,facets wrote:what code or application are using with the php_pspell class?
Do you have any errors in your apache logs?
i am not getting any errors and i am using Windows Server and IIS.
so please tell me configuration for that...
Moderator: General Moderators
Unfortunately I have never used pspell with windows so I cannot really help you.Note to Win32 Users: In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: aspell-15.dll from the bin folder of the aspell installation.
Win32 support is available only in PHP 4.3.3 and later versions. Also, at least aspell version 0.50 is required.
Code: Select all
<?php
function spell_check ( $string, $misspelled = array (), $return = array () )
{
$words = preg_split ( '/[\W]+?/', $string );
/* we use the following (2) functions instead of pspell_new() */
// reset the dictionary path, Aspell will look at the system environment Path
// anytime pspell_new_config() is called, over-riding the default hard-coded values
$config = pspell_config_create ( 'en_US', '', '', 'utf-8' );
$int = pspell_new_config ( $config );
foreach ( $words as $value )
{
if ( ! pspell_check ( $int, $value ) )
{
$misspelled[] = $value;
}
}
foreach ( $misspelled as $value )
{
$return[$value] = pspell_suggest ( $int, $value );
}
return $return;
}
print_r ( spell_check ( 'the hetel was raelly baad' ) );
?>Hey Buddyprintf wrote:pspell_new doesn't work correctly on most servers under Windows because like PHP, the Aspell developer thinks because your using Windows you don't know how to set a environment path, so the path and names to the dictionaries are hard-coded into the embedded Aspell configuration file that point to C:\Aspell\, so if you install it anywhere else, Aspell will not find the dictionaries. So instead of using pspell_new(), use pspell_new_config() and add (2) system environment paths to the your system Path string under Environment Variables, (1) that point to the base directory where Aspell is installed (C:\web\services\aspell), and (1) that points to the Aspell bin directory (C:\web\services\aspell\bin). Then do something like this....
Code: Select all
<?php function spell_check ( $string, $misspelled = array (), $return = array () ) { $words = preg_split ( '/[\W]+?/', $string ); /* we use the following (2) functions instead of pspell_new() */ // reset the dictionary path, Aspell will look at the system environment Path // anytime pspell_new_config() is called, over-riding the default hard-coded values $config = pspell_config_create ( 'en_US', '', '', 'utf-8' ); $int = pspell_new_config ( $config ); foreach ( $words as $value ) { if ( ! pspell_check ( $int, $value ) ) { $misspelled[] = $value; } } foreach ( $misspelled as $value ) { $return[$value] = pspell_suggest ( $int, $value ); } return $return; } print_r ( spell_check ( 'the hetel was raelly baad' ) ); ?>