views:

337

answers:

1

I've installed the sphinx binaries and libraries and am now trying to install the PECL sphinx module.

My system is running OS X 10.6 with MAMP 1.8.2 installed. I try to install sphinx using the following command:

sudo pecl install sphinx

The PECL command outputs the following:

running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

The versions above don't match the versions listed when doing a phpinfo(). It seems that PECL is trying to complie against the built-in version of PHP.

If I ignore the errors and continue the it will successfully compile and place the sphinx.so file in:

/usr/lib/php/extensions/no-debug-non-zts-20090626/sphinx.so

when in fact it should be:

/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/

I've tried copying the sphinx.so file to the MAMP extensions dir but when I restart apache PHP displays the following warning:

PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/sphinx.so

I think this is because MAMP is 32bit and the built-in PHP is 64bit so PECL complies for 64bit. I might be completely wrong but I did read this when I goggled on the topic.

Does anyone know how to get PECL to map to the MAMP version of PHP instead of the built-in version?

+2  A: 

If the "correct" version of PHP is installed in something like /Applications/MAMP/bin/php5/, and has the development tools included, you should have some version of the pecl command to go with it, some next to that directory.

If so, running that pecl command that corresponds to your "correct" version of PHP should help : it'll run the correct version of phpize, and will allow the extension to be compiled against the (once again) correct version of PHP.

You just have to hope that MAMP includes those commands -- I cannot check, as I don't have a mac.

Pascal MARTIN
yes, there's /Applications/MAMP/bin/php5/bin/pecl
stereofrog