Preparatory work
To install the Sphinx extension in PHP, you must first install the Sphinx, the author uses Chinese participle, so I installed the Coreseek.
How to install Coreseek see: http://www.coreseek.cn/products-install/install_on_bsd_linux/
installation process
Installation process:
1, installation Libsphinclient
2. Install PHP Sphinx Extension Module
3. PHP Configuration
4. Testing
Installing Libsphinxclient
Enter the code directory for Coreseek
cd /usr/local/src/coreseek-4.1-beta/csft-4.1/api/libsphinxclient./configure --prefix=/usr/local/sphinxmake && make install
Installing the PHP Sphinx Extension Module
Download Address: Https://pecl.php.net/package/sphinx. Download the version you want.
tar -zxvf sphinx-1.3.3.tgzcd sphinx-1.3.3/usr/local/php/bin/phpize./configure --with-php-c/local/php/bin/php-config --with-sphinx=/usr/local/sphinx/make && make install
PHP Configuration
Modify the php.ini file to extension=sphinx.so
add to the Extended Options section.
Test the installation Results
Restart PHP and enter to php -m | grep 'sphinx'
see if the installation was successful.
Error resolution
During the installation process, a comparison of two errors was encountered. Added extension=sphinx.so
, the operation php -m
of the time has been an error. 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 dependent libraries, but the previously installed libsphinxclient
dependent libraries are present. So I looked for the next colleague to help me to see, and then in fact, colleagues do not understand, but, he and I think together, he told me to look at the log files together to figure out which step error. We found that there was no problem with the first few steps of the installation, until the software to be installed failed to find a dependent library, where is the required library installed, in that place? So find it, find it, and then I see the wrong path, and suddenly it dawned, where does the software search for this library? Could it be another directory? Then look at the configuration file, it is found that the search is really wrong, because the computer is 64-bit, so the previous installation depends on the installation of the 64-bit library, and the installation of the extension is from the 32 library directory to find the dependent library. The problem is finally solved.
Summarize
Under openSUSE, there are times when installing and searching for directories that depend on libraries are inconsistent and should be checked carefully. In solving the problem, if it takes a lot of time to solve, this time, find a person, the problem you encountered clearly described again, and then solve together, maybe he did not understand, but he thought the direction may be you ignore, but he will guide you to a new direction of thinking, and then you will find that you neglect something , this time, the problem is solved, others may not do anything, just chat with you, the problem is solved. So often encounter thanks to others who don't know what you thank him for.
Original article, writing Limited, Caishuxueqian, if there is not in the text, million hope to inform.
If you think this article is helpful to you or feel good, look at the recommendation, writing articles is not easy.
The above describes the compilation and installation of Sphinx extension on openSUSE, including the content of the aspects, I hope that the PHP tutorial interested in a friend helpful.