gmail 发表于 2015-1-3 12:02:45

在 Ubuntu Server 14.04 下以 pecl 方式安装 PHP5 的 Sphinx 1.3.2 扩展

在 Ubuntu Server 14.04 下以 pecl 方式安装 PHP5 的 Sphinx 1.3.2 扩展
Sphinx 是一个基于 SQL 的全文检索引擎,可以结合 MySQL、MariaDB、PostgreSQL 做全文搜索。它能提供比数据库本身更专业的搜索功能,使得应用程序更容易实现专业化的全文检索。Sphinx 特别为一些脚本语言设计了搜索 API 接口,譬如:PHP、Python、Perl、Ruby 等,同时还为 MySQL 设计了一个存储引擎插件。
Sphinx 是 SQL Phrase Index 的缩写,但不幸的是和 CMU 的 Sphinx 项目重名。
Sphinx 单一索引最大可包含 1 亿条记录,在 1 千万条记录情况下的查询速度为 0.x 秒(毫秒级)。Sphinx 创建索引的速度,譬如:创建 100 万条记录的索引只需 3~4 分钟,创建 1000 万条记录的索引可在 50 分钟内完成,而只包含最新 10 万条记录的增量索引,重建一次只需几十秒。
应用程序可通过 3 种不同接口方式与 Sphinx 搜索服务 (searchd) 通信:1、通过原生搜索 API (SphinxAPI);
2、通过 Sphinx 自身支持的 MySQL 网络协议 (使用命名为 SphinxQL 的 SQL 精简子集);
3、通过 MySQL 服务端存储插件引擎 (SphinxSE);
当然, 还可通过使用 1、2、3 的应用程序构建 Web Service 为其他应用程序提供通信。
若想全文检索中文,可考虑使用 Coreseek。
01、以 pecl 方式直接安装 Sphinx 1.3.2
root:# pecl install sphinx
downloading sphinx-1.3.2.tgz ...
Starting to download sphinx-1.3.2.tgz (15,282 bytes)
.....done: 15,282 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Please provide the installation prefix of libsphinxclient : /usr/local/libsphinxclient    #libsphinxclient 前缀
building in /tmp/pear/temp/pear-build-rootQpH1re/sphinx-1.3.2
running: /tmp/pear/temp/sphinx/configure --with-sphinx=/usr/local/libsphinxclient
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for sphinx support... yes, shared
checking for libsphinxclient headers in /usr/local/libsphinxclient... not found
configure: error: Cannot find libsphinxclient headers    #错误提示:安装过程中出现问题
ERROR: `/tmp/pear/temp/sphinx/configure --with-sphinx=/usr/local/libsphinxclient' failed    #错误提示:安装过程中出现问题
root:#02、修复 libsphinxclient 错误提示root:# cd /var/coreseek-4.1-beta/testpack/api/libsphinxclient
root:/var/coreseek-4.1-beta/testpack/api/libsphinxclient# ./configure --prefix=/usr/local/libsphinxclient    #配置 libsphinxclient
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... none
checking for a sed that does not truncate output... /bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... /lib/cpp
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... failed
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flagworks... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
appending configuration tag "F77" to libtool
checking for a BSD-compatible install... /usr/bin/install -c
checking for size_t... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for unistd.h... (cached) yes
checking for stdint.h... (cached) yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sphinxclient_config.h
config.status: executing depfiles commands
root:/var/coreseek-4.1-beta/testpack/api/libsphinxclient#
03、编译、安装 libsphinxclientroot:/var/coreseek-4.1-beta/testpack/api/libsphinxclient# make && make install    #编译、安装 libsphinxclient
makeall-am
make: 正在进入目录 `/var/coreseek-4.1-beta/testpack/api/libsphinxclient'
/bin/bash ./libtool --mode=compile --tag=CC gcc -DHAVE_CONFIG_H -I. -I. -I.   -g -O2 -c -o sphinxclient.lo sphinxclient.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c sphinxclient.c-fPIC -DPIC -o .libs/sphinxclient.o
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c sphinxclient.c -o sphinxclient.o >/dev/null 2>&1
/bin/bash ./libtool --mode=link --tag=CC gcc-g -O2   -o libsphinxclient.la -rpath /usr/local/libsphinxclient/lib -release 0.0.1 sphinxclient.lo
gcc -shared.libs/sphinxclient.o   -Wl,-soname -Wl,libsphinxclient-0.0.1.so -o .libs/libsphinxclient-0.0.1.so
(cd .libs && rm -f libsphinxclient.so && ln -s libsphinxclient-0.0.1.so libsphinxclient.so)
ar cru .libs/libsphinxclient.asphinxclient.o
ranlib .libs/libsphinxclient.a
creating libsphinxclient.la
(cd .libs && rm -f libsphinxclient.la && ln -s ../libsphinxclient.la libsphinxclient.la)
gcc -DHAVE_CONFIG_H -I. -I. -I.   -g -O2 -c test.c
test.c: In function ‘test_status’:
test.c:296:22: warning: incompatible implicit declaration of built-in function ‘strstr’
   if ( !g_smoke || ( strstr ( status, "time" )==NULL && strstr ( status, "wall" )==NULL ) )
                      ^
test.c: In function ‘title’:
test.c:341:2: warning: ' ' flag used with ‘%s’ gnu_printf format [-Wformat=]
printf ( "-> % s <-\n\n", name );
^
/bin/bash ./libtool --mode=link --tag=CC gcc-g -O2   -o testtest.o .libs/libsphinxclient.a
gcc -g -O2 -o test test.o.libs/libsphinxclient.a
make:正在离开目录 `/var/coreseek-4.1-beta/testpack/api/libsphinxclient'
make: 正在进入目录 `/var/coreseek-4.1-beta/testpack/api/libsphinxclient'
test -z "/usr/local/libsphinxclient/lib" || mkdir -p -- "/usr/local/libsphinxclient/lib"
/bin/bash ./libtool --mode=install /usr/bin/install -c -s 'libsphinxclient.la' '/usr/local/libsphinxclient/lib/libsphinxclient.la'
/usr/bin/install -c .libs/libsphinxclient-0.0.1.so /usr/local/libsphinxclient/lib/libsphinxclient-0.0.1.so
strip --strip-unneeded /usr/local/libsphinxclient/lib/libsphinxclient-0.0.1.so
(cd /usr/local/libsphinxclient/lib && rm -f libsphinxclient.so && ln -s libsphinxclient-0.0.1.so libsphinxclient.so)
/usr/bin/install -c .libs/libsphinxclient.lai /usr/local/libsphinxclient/lib/libsphinxclient.la
/usr/bin/install -c .libs/libsphinxclient.a /usr/local/libsphinxclient/lib/libsphinxclient.a
strip --strip-debug /usr/local/libsphinxclient/lib/libsphinxclient.a
ranlib /usr/local/libsphinxclient/lib/libsphinxclient.a
chmod 644 /usr/local/libsphinxclient/lib/libsphinxclient.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/libsphinxclient/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/libsphinxclient/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
   during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
   during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/libsphinxclient/include" || mkdir -p -- "/usr/local/libsphinxclient/include"
/usr/bin/install -c -m 644 'sphinxclient.h' '/usr/local/libsphinxclient/include/sphinxclient.h'
make:正在离开目录 `/var/coreseek-4.1-beta/testpack/api/libsphinxclient'
root:/var/coreseek-4.1-beta/testpack/api/libsphinxclient#04、再次以 pecl 方式直接安装 Sphinx 1.3.2
root:/var/coreseek-4.1-beta/testpack/api/libsphinxclient# pecl install sphinx
downloading sphinx-1.3.2.tgz ...
Starting to download sphinx-1.3.2.tgz (15,282 bytes)
.....done: 15,282 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Please provide the installation prefix of libsphinxclient : /usr/local/libsphinxclient    #libsphinxclient 前缀
building in /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2
running: /tmp/pear/temp/sphinx/configure --with-sphinx=/usr/local/libsphinxclient
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for sphinx support... yes, shared
checking for libsphinxclient headers in /usr/local/libsphinxclient... found
checking for sphinx_create in -lsphinxclient... yes
checking for sphinx_get_string in -lsphinxclient... yes
checking for new sphinx_set_ranking_mode() signature... no
checking for SPH_RANK_PROXIMITY in sphinxclient.h... found
checking for SPH_RANK_MATCHANY in sphinxclient.h... found
checking for SPH_RANK_FIELDMASK in sphinxclient.h... found
checking for SPH_RANK_SPH04 in sphinxclient.h... found
checking for SPH_RANK_EXPR in sphinxclient.h... not found
checking for SPH_RANK_TOTAL in sphinxclient.h... not found
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/libtool --mode=compile cc-I. -I/tmp/pear/temp/sphinx -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/include -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/main -I/tmp/pear/temp/sphinx -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/libsphinxclient/include-DHAVE_CONFIG_H-g -O2   -c /tmp/pear/temp/sphinx/sphinx.c -o sphinx.lo
libtool: compile:cc -I. -I/tmp/pear/temp/sphinx -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/include -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/main -I/tmp/pear/temp/sphinx -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/libsphinxclient/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/sphinx/sphinx.c-fPIC -DPIC -o .libs/sphinx.o
/bin/bash /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/include -I/tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/main -I/tmp/pear/temp/sphinx -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/libsphinxclient/include-DHAVE_CONFIG_H-g -O2   -o sphinx.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modulessphinx.lo -Wl,-rpath,/usr/local/libsphinxclient/lib -L/usr/local/libsphinxclient/lib -lsphinxclient -Wl,-rpath,/usr/local/libsphinxclient/lib -L/usr/local/libsphinxclient/lib -lsphinxclient
libtool: link: cc -shared-fPIC -DPIC.libs/sphinx.o   -Wl,-rpath -Wl,/usr/local/libsphinxclient/lib -Wl,-rpath -Wl,/usr/local/libsphinxclient/lib -L/usr/local/libsphinxclient/lib /usr/local/libsphinxclient/lib/libsphinxclient.so-O2 -Wl,-rpath -Wl,/usr/local/libsphinxclient/lib -Wl,-rpath -Wl,/usr/local/libsphinxclient/lib   -Wl,-soname -Wl,sphinx.so -o .libs/sphinx.so
libtool: link: ( cd ".libs" && rm -f "sphinx.la" && ln -s "../sphinx.la" "sphinx.la" )
/bin/bash /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/libtool --mode=install cp ./sphinx.la /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modules
libtool: install: cp ./.libs/sphinx.so /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modules/sphinx.so
libtool: install: cp ./.libs/sphinx.lai /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modules/sphinx.la
libtool: finish: PATH="/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin" ldconfig -n /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/pear/temp/pear-build-rootaxCAVo/sphinx-1.3.2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
   during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
   during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2" install
Installing shared extensions:   /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr/lib/php5/20121212/
running: find "/tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2" | xargs ls -dils
4194391   4 drwxr-xr-x 3 root root   40961月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2
4194413   4 drwxr-xr-x 3 root root   40961月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr
4194414   4 drwxr-xr-x 3 root root   40961月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr/lib
4194415   4 drwxr-xr-x 3 root root   40961月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr/lib/php5
4194416   4 drwxr-xr-x 2 root root   40961月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr/lib/php5/20121212
4194412 192 -rwxr-xr-x 1 root root 1944481月3 12:46 /tmp/pear/temp/pear-build-rootaxCAVo/install-sphinx-1.3.2/usr/lib/php5/20121212/sphinx.so

Build process completed successfully
Installing '/usr/lib/php5/20121212/sphinx.so'
install ok: channel://pecl.php.net/sphinx-1.3.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=sphinx.so" to php.ini
root:/var/coreseek-4.1-beta/testpack/api/libsphinxclient# 05、修改 /etc/php5/fpm/php.ini 配置文件
vi /etc/php5/fpm/php.ini 将 extension=sphinx.so 或 extension=/usr/lib/php5/20121212/sphinx.so 添加到 /etc/php5/fpm/php.ini 文件相应位置。如下所示:
; For example, on Windows:
;
;   extension=msql.dll   
;
; ... or under UNIX:
;
;   extension=msql.so
    extension=sphinx.so    #添加项
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
    extension=/usr/lib/php5/20121212/sphinx.so    #添加项
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.06、重载、重启 php5-fpm5.5.9、nginx 1.4.6root:# service php5-fpm reload
root:# service php5-fpm restart
stop: Unknown instance:
php5-fpm start/running, process 22075
root:# service nginx reload
* Reloading nginx configuration nginx                                                                           [ OK ]
root:# service nginx restart
* Restarting nginx nginx                                                                                          [ OK ]
root:#07、创建名为 “info.php” 的 PHP 探针文件,并测试
vi /usr/share/nginx/html/info.php (或把 info.php 放到支持 php 的网站根目录下)文件内容:
<?php
phpinfo();
?>在 FireFox 或 IE 浏览器中键入 http://localhost/info.php 或 http://127.0.0.1/info.php (或 http://服务器 IP 地址/info.php 或 http://域名地址/info.php);若出现以下图片内容,说明 Sphinx 1.3.2 安装成功 (若仍没有出现,请重启一下 Ubuntu Server 14.04):
版权声明:
本文为独家原创稿件,版权归 德云社区,未经许可不得转载;否则,将追究其法律责任。

gmail 发表于 2015-1-3 12:04:03

Sphinx, Coreseek, Ubuntu Server, PHP, MySQL

gmail 发表于 2015-1-3 12:04:18

Sphinx, Coreseek, Ubuntu Server, PHP, MySQL

页: [1]
查看完整版本: 在 Ubuntu Server 14.04 下以 pecl 方式安装 PHP5 的 Sphinx 1.3.2 扩展