Discussion:
[PHP-INSTALL] Enabling pspell in PHP on Mac OS X 10.6
Torrey Jones
2011-11-18 23:00:29 UTC
Permalink
Hello,

I've been attempting to get the pspell functions in PHP to work for a while now with no success. I was directed by http://php.net/manual/en/function.pspell-new.php to "check out inline manual pspell website:» http://aspell.net/." This led me to conclude that I must install aspell in order to get the PHP pspell functions to work, so that's what I did. Before proceeding, I shut down MAMP (Mac, Apache, MySQL, and PHP) to avoid any conflicts during the install process.

First, I installed aspell-0.60.6.1 as well as aspell6-en-7.1-0, doing the "./configure" and "make" and "sudo make install" steps for each. I'm able to confirm from the terminal command line that aspell is actually working ("aspell help" yields a nice long list of command syntax, options, and available dictionaries).

Next, I downloaded the PHP source code for php-5.3.6 (which is what my version of MAMP came with, and I didn't want to upset the apple cart by trying to change versions) then recompiled it using the following command:
"./configure --prefix=/Applications/MAMP/bin/php/php5.3.6/bin --exec-prefix=/Applications/MAMP/bin/php/php5.3.6/bin --sysconfdir=/Applications/MAMP/bin/php/php5.3.6/conf --with-config-file-path=/Applications/MAMP/bin/php/php5.3.6/conf --with-pspell"
(NOTE: I was not able to supply the --with-pspell option with a directory because I couldn't figure out which directory it wanted. I tried the directory returned by the command "which aspell" so it was "--with-pspell=/opt/local/bin/aspell" for me, but that caused this error "configure: error: Cannot find pspell". So I simply left off the directory and it appeared to work.)
make
sudo make install

After this, I restarted MAMP and it seemed to me that I should be able to use pspell_new() and then all the other pspell functions in PHP, but they're still not working. By checking my PHP log file, I see this error: "PHP Fatal error: Call to undefined function pspell_new() in /Applications/MAMP/htdocs/test.php on line 23"

What am I missing here? How come PHP isn't recognizing my aspell installation and using it for the pspell functions?

Thanks in advance,
Torrey
Paul Reinheimer
2011-11-20 03:44:32 UTC
Permalink
Hi Torrey,
What am I missing here?  How come PHP isn't recognizing my aspell
installation and using it for the pspell functions?
If you look at the output of phpinfo(); does it report that you have
these functions installed? There should be a section for each
installed component, including pspell if the configure worked
properly.

Also double check that the configure line it shows at the top of the
page shows your configure line. If not the PHP MAMP is running isn't
the one you built.


paul
--
Paul Reinheimer
Loading...