Mac OSX 10.6, Zend Server and Sphinx Extension for PHP

Lately I tried to install the sphinx extension for PHP on my development computer with Mac OSX 10.6 and Zend Server 4. Trying this the same way like the imagick-extension, this should be easy and done in a few minutes.

To install the main Sphinx full-text search engine use MacPorts:

sudo port install sphinx

Now comes the delicate part which was finally resolved by Jess Portnoy from the official Zend Forum. I started a thread there about my problems with this extension and the solution can be found in form of a shellscript wich download and installs the libsphinxclient-library and successfully compiles and installs the sphinx-extension:

#!/bin/sh
mkdir -p /lib; ln -s /usr/bin/cpp /lib/cpp
TMPDIR=/tmp
# export FLAGS:
export CFLAGS="-arch x86_64 -arch i386"
export CXXFLAGS="-arch x86_64 -arch i386"
export LDFLAGS="-arch x86_64 -arch i386"
# retrieve and extract the Sphinx lib
ftp http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
tar zxvf sphinx-0.9.8.1.tar.gz -C $TMPDIR
# retrieve the Sphinx PECL PHP ext
ftp http://pecl.php.net/get/sphinx
tar zxvf sphinx -C $TMPDIR
cd $TMPDIR/sphinx-0.9.8.1/api/libsphinxclient
export CPP=/usr/bin/cpp
./configure --disable-dependency-tracking
make && make install
cd $TMPDIR/sphinx-1.0.0
/usr/local/zend/bin/phpize
./configure --with-php-config=/usr/local/zend/bin/php-config
make && make install

This is the enhanced script which fixes a small problem with the original script. Just don’t forget to restart the apache-server and activate the sphinx-extension.

0 Responses to “Mac OSX 10.6, Zend Server and Sphinx Extension for PHP”


  • No Comments

Leave a Reply