The preparatory work

To install the Sphinx extension in PHP, you must have Sphinx installed first. I am using Chinese word participlers, so I installed Coreseek.

How to install coreseek please see: http://www.coreseek.cn/products-install/install_on_bsd_linux/

The installation process

Installation process:

1. Install libsphinclient

Install the PHP Sphinx extension module

3. PHP configuration

4, test,

Install libsphinxclient

Go to the coreseek code directory

CD /usr/local/ SRC/coresek-4.1-beta /csft-4.1/ API /libsphinxclient./configure --prefix=/usr/local/sphinx make && make install

Install the PHP Sphinx extension module

Download address: https://pecl.php.net/package/sphinx. Download the version you want.

Tar - ZXVF sphinx - 1.3.3. Sphinx - 1.3.3 TGZ CD/usr/local/PHP/bin/phpize. / configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinx/ make && make install

PHP configuration

Modify the php.ini file and add extension=sphinx.so to the extension options section.

Test installation results

Restart PHP, enter PHP -m | grep ‘sphinx’ check whether the installation is successful.

Error resolution

During installation, a comparison error was encountered. Add extension=sphinx.so and keep getting an error when running php-m. The error message is as follows:

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/sphinx.so’ – Libsphinxclient-0.0.1. so: cannot open shared object file: No such file or directory in Unknown on line 0

The error above is that the software cannot load the library dependencies, but the LibSphinxClient libraries installed previously do exist. So I asked my colleague next to me to read it for me, and he didn’t understand it either, but he was thinking with me, and he asked me to look at the log file and figure out what went wrong. We found that the first steps of the installation were fine until the software to be installed could not find a certain dependent library. Where is the required library installed? So I look for it, and I see, oh, yeah, and then I see the wrong path, and I suddenly realize, where is this software going to search for this library? Could it be a different directory? Then I checked the configuration file and found that I was searching in the wrong place, because the computer is 64-bit, so I installed the 64-bit library when I installed the dependency, and the extension I installed was looking for the dependency library from the 32 library directory. The problem was solved at last.

conclusion

Under OpenSUSE, there are many times when installing and searching the directory of the dependent library is inconsistent and should be carefully checked. In solving a problem, if not solve, spent a lot of time at this time, looking for a man, describe the problems you clearly again, and then to solve, maybe he doesn’t understand, but he ignored the direction of thinking may be you, however, he will lead you to a new direction of thinking, and then you’ll find that you have overlooked something, this time, The problem is solved. The other person may not have done anything but just talked to you and the problem is solved. So often will meet thank others others do not know what you thank him.

Original article, writing style is limited, talent is shallow, if there is something wrong in the article, wang told.

If you find this article helpful or good, check out the recommendations below. It’s not easy to write this article.