Thursday, April 4, 2013

Enabling Pspell for PHP in XAMPP on Windows

PHP provides spell checking functionality through the Pspell extension. Despite its name, the extension uses the Aspell library, as development of the Pspell library ceased in 2001. Being part of the GNU Project, Aspell is part of most Linux distributions but is not supplied with Windows. This page explains how to install Aspell and enable the Pspell extension in XAMPP on Windows.

Downloading and installing Aspell

A Windows port of Aspell is available on the Aspell website. The Windows port has not been updated in several years, but still functions on recent version of Windows.
First, download and run the ‘full installer’, which installs the library itself. Then download and install at least one language’s dictionary from the same page.

Copying the library DLL

While the PHP manual states that the Aspell DLL must be available within the Windows system path, under XAMPP it must be available in Apache’s ‘bin’ directory. Find the file aspell-15.dll, which by default is installed at C:\Program Files\Aspell\bin\aspell-15.dll, and copy it to the Apache ‘bin’ directory, which by default resides at C:\xampp\apache\bin.

Enabling the Pspell extension

To enable the Pspell extension, first find the php.ini file, which, depending on the XAMPP version, is by default located at either C:\xampp\apache\bin\php.ini or C:\xampp\php\php.ini. Open it in a text editor, find the following line (which should be in a block relating to extensions about halfway down the file), and remove the semicolon:
;extension=php_pspell.dll
If the line above wasn’t present in the file, add the following line:
extension=php_pspell.dll
Finally, enable the extension by restarting Apache using the XAMPP control panel.

No comments:

Post a Comment