note 85191 added to function.pspell-new-config
| From: | soapergem at gmail dot com | Date: | Tue, 19 Aug 2008 15:34:11 +0000 |
| Subject: | note 85191 added to function.pspell-new-config | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143636@lists.php.net to get a copy of this message | ||
Today I ran into an interesting problem that I thought I'd share here to save the next
developer that ends up in the same situation a whole lot of trouble. I have been running PHP5 as a
FastCGI module on a Windows IIS server, and I recently installed the Aspell library and enabled the
pspell extension in my php.ini file. I also installed the English Aspell dictionary. But when I went
to use pspell, I was getting ambiguous errors that would terminate script execution without warning.
So I started to break things down, and came to the conclusion that the following code successfully
executed its first line, but broke on the last line with the call to pspell_new_config:
<?php
$pspell_config = pspell_config_create('en');
$pspell_link = pspell_new_config($pspell_config);
?>
This returned a FastCGI error in the browser, with error number -2147467259 (0x80004005). By luck, I
happened to think to try the same script via the command line, which gave a much more descriptive
error. What happened was that the dictionary installer created the *.dat files in the Aspell\data
directory using the Windows standard CRLF "\r\n" instead of the UNIX standard
"\n" for line feeds. By changing these all back to the UNIX standard, everything worked.
It's apparently very touchy about these line feeds, so if you're wracking your brain over
why pspell_new_config is breaking your scripts and you're using a Windows server, start by
ensuring that there aren't any extraneous "\r" characters in your dictionary files.
----
Server IP: 209.41.74.194
Probable Submitter: 66.170.10.66
----
Manual Page -- http://www.php.net/manual/en/function.pspell-new-config.php
Edit -- https://master.php.net/note/edit/85191
Del: integrated -- https://master.php.net/note/delete/85191/integrated
Del: useless -- https://master.php.net/note/delete/85191/useless
Del: bad code -- https://master.php.net/note/delete/85191/bad+code
Del: spam -- https://master.php.net/note/delete/85191/spam
Del: non-english -- https://master.php.net/note/delete/85191/non-english
Del: in docs -- https://master.php.net/note/delete/85191/in+docs
Del: other reasons-- https://master.php.net/note/delete/85191
Reject -- https://master.php.net/note/reject/85191
Search -- https://master.php.net/manage/user-notes.php