Aspell 0.60.3 for Win32
At work I wanted to get Aspell working with PHP on our Windows servers. Unfortunately, the Windows Aspell port hasn’t been updated in nearly three years. It’s all open source so I thought, “Self, how hard can it be to compile and provide for others to have?”
Download Aspell 0.60.3
- Windows installer - (new) .exe file with en-US dictionary (must install to “C:\Program Files\”)
- .zip file - with en-US dictionary (must install to “C:\Aspell”)
Short version: I got it working, and you can download it from me if you’d like. (No guarantees about anything, though.) It took a lot of tinkering with makefiles, build environments, and so forth… the details are below (including how I actually got it working with PHP 5 on IIS).
Usage (for .zip file version)
Unzip the contents of the download onto the root of your C:\.
The path, unfortunately, is hard coded into the binary. The --enable-win32-relocatable option is currently not working in the Aspell sources.
I would have chosen C:\Program Files\ as the default install path, but the space in the path name gave me trouble. Update Seth got it working by using C:\Progra~1\Aspell for the installer version.
All of your dictionary files should go into C:\Aspell\data. The en-US dictionary is included in the .zip. If people are interested I can build other dictionaries as well.
That’s it! Add C:\Aspell\bin to your PATH environment variable if you want to be able to run it anywhere. Otherwise, test the binary by typing aspell dump dicts from the command line.
Config Files
The aspell.conf file in the \bin directory should actually be placed into a `C:\Aspell\etc directory. The binary will look for that file and adjust its options accordingly.
The included aspell.conf file was created by running aspell config > aspell.conf.
Building Aspell on Win32
I used minGW (default install), ActivePerl (latest version) and MSYS-1.0.10.
Download links
Build Tweaks
To get aspell to compile, I had to
- install Perl on my local machine
- run this from the MSys environment
./configure CXXFLAGS='-O2 -mno-cygwin' --enable-win32-relocatable --disable-rpath --prefix="C:/Aspell" --enable-data-dir="C:/Aspell/data" --enable-dict-dir="C:/Aspell/data"
- add a line to file_util.cpp under the “#ifdef WIN32″ section
#include "asc_ctype.hpp"
- Change the
DEFAULT_INCLUDESline in the master Makefile
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/gen -I$(top_builddir)/interfaces/cc -I$(top_builddir)/modules/speller/default
- run
make
When compilation fails, replace the LDFLAGS = line with
LDFLAGS = common/.libs/*.o
When it fails again, reset it to
LDFLAGS =
- run
make install
Packaging
I then downloaded the latest en-US dictionary, and ran ./configure; make; make install.
The contents of this file are the contents of the created install directory.
I don’t include any .reg files to register the .dlls in this package. Look at the ones from the 0.50.3 installer if you’d like to see what they did.
Help Request: 0.50.3 had a nifty windows installer and (probably) wasn’t limited in its install path location. Care to help me out here?
Aspell with PHP5 and IIS
It took several false starts to get it working as a PHP extension, but finally managed by trial and error.
- Copy the libaspell-15.dll from the
/bindirectory to your/phpdirectory. - Rename
libaspell-15.dllto copy it to/php/aspell-15.dll. - Add the line
ext=php_pspell.dllto the extensions section of yourphp.ini. The php_pspell.dll file should live in your/php/ext/directory. If it’s not there you may have to also download the collection of PECL modules for your PHP version. It is essentially a pspell wrapper (what PHP expects) to the aspell library. - Restart IIS.
Getting it working with DokuWiki
Why doesn’t it work with DokuWiki’s spellcheck function? It continued to fail on the proc_open() function call in the Aspell.php class.
Solution: the default web user needs read/execute rights to cmd.exe in your \Windows\System32 directory. (Yes, that’s a bit of a security issue, but it seems there’s no way around it.) Seems this is a known issue with any of the exec() commands in PHP on Win32 platforms.
Once I gave it the appropriate permissions, the spell check worked! (See my writeup on getting Aspell working with PHP.)
(only showing the 10 most recent - View All Comments)
Wow. Either the comment directly above this one is a genunie request for more information, or one of the most cleverly disguised blog spams I’ve run across. Here’s my ping - if the above user is real then post another comment and I’ll get ahold of you.
A slightly related link: fake viral marketing, a Slate.com article about the some markeint tactics for the King mask.
Oh, No I’m real at least I think I am.
Stabs self
Yeah I’m bleeding, real enough.
I’ve been doing alot of reading and have come to some blocks. Thanks for taking the time to reply.
G
Hi. I was wondering if anyone has managed to get personal wordlists working. It’s almost impossible to find good info on using this stuff on Windows, and the linux-based instructions are often useless. I was able to get ASpell working with Dokuwiki, by sheer perseverance and some dumb luck, but that hasn’t worked for the wordlists. I’m trying to implement it at work, too, but without the ability to customize it for the jargon we use, it’s pretty useless.
Many thanks.
Is a lib file available? I want to use this with a Qt app compiled with MSVC.
Dear James,
I installed your Windows Aspell port (Aspell 0.60.3 for Win32) with the en-US dictionary. Then I installed the German and the Hungarian dictionary (from the official GNU Aspell web site). I use the Aspell library linked into my own Win32 application.
All works fine for English (as expected) and also for German. But when I use the Hungarian dictionary there often occurs an Access Violation in “libaspell-15.dll”. The error occurs when aspell_speller_store_replacement() is called to store replacement pairs or when aspell_speller_suggest() is called to get correction proposals for ‘words’ like “1600″ (without the quotes) that were classified as spelling mistakes by previous calls to aspell_speller_check().
I would really appreciate any help on making Aspell work with a Hungarian dictionary.
Do you know whether there is any other dictionary for Hungarian than the one in “aspell6-hu-0.99.4.2-0.tar.bz2″ from the GNU Aspell web site?
Are you working on a Windows port for the actual version 0.60.5 of Aspell or do you plan to port this version? (Maybe the problem that causes the Access Violation has already been fixed in this version.)
Many Thanks,
Markus
Wow, time flies. It’s been almost a year and a half since I was last here. Now it’s because PHP 5 broke my spellchecking. Is there a chance we could pursuade you to do a port of the new version? Not that I’m sure that would fix the incompatibility, but it seems likely.
I just wanted to thank you for making this available. I just got it working with my new Dokuwiki installation and it works great.
I used the Zip install method. One thing that may not have been clear (or maybe I just missed it) is that even if you install aspell into c:program filesAspell, you still have to put the config file in c:Aspelletc. So that means you create directory c:Aspelletc and then copy the apsell.conf file there, renaming it “aspell.conf”. Then, to configure it, you go into that file and only need to change the “prefix” entry so that it reads “prefix C:/PROGRA~1/Aspell” and then everything will work.
P.S. the backslashes got removed from my previous post, so keep that in mind when reading the paths…
I get the error message
“Call to undefined function pspell_config_create() in d:mediawikiextensionsspellcheckspellcheckext.php”
I reinstalled aspell. I was able to use aspell outside of my wiki.
Thank you appreciate your help!
N2201
Thanks for getting this packaged in a nice installer. Worked out great for me when integrating into my WYSIWYG editor.