Sphinx. Installing the pecl-sphinx PHP Extension
As I promised in the article “Sphinx. Installing, Configuring, and Using the Search Engine”, I’ll explain how to install the PHP extension so you don’t have to include the “sphinxapi.php” file.
First, let’s build “libsphinxclient”:
# fetch http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
# tar -xzf sphinx-0.9.8.1.tar.gz
# cd sphinx-0.9.8.1
# chmod -R 777 *
# cd ./api/libsphinxclient/
# ./buildconf.sh
# ./configure && make install
Now let’s install the PECL extension:
# cd sphinx-0.9.8.1/api/libsphinxclient/
# pecl install sphinx
When it asks about “libsphinxclient”, just accept the default. Since you’re in the same directory where you built “libsphinxclient”, it will pick it up automatically.
After installation, you need to add the module to “php.ini” or “php/extensions.ini”:
# echo "extension=sphinx.so" >> /usr/local/etc/php/extensions.ini
# cat /usr/local/etc/php/extensions.ini
You’ll get something like this:
extension=mbstring.so
extension=simplexml.so
extension=spl.so
extension=mysql.so
....
extension=sphinx.so
Restart Apache and off we go! :)
# apachectl restart
Comments are closed. Read the original discussion in Russian →
