Board logo

标题: [求助] linux白痴请教php扩展的问题 [打印本页]

作者: biyexp    时间: 2012-2-23 15:26     标题: linux白痴请教php扩展的问题

Error
The following PHP extensions are missing:
    sockets
Please install those PHP extensions and retry





说是需要php Sockets的一个扩展, 如何安装呀?我只知道windows里只要把php.ini的模块注释去掉就可以了,linux里不是这样。求教啊。
作者: biyexp    时间: 2012-2-23 16:40

本帖最后由 biyexp 于 2012-2-23 17:07 编辑

首先我进入了源码目录下/lanmp/php-5.2.17/ext/sockets
# /www/wdlinux/php/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519

然后执行#./configure  提示错误
configure: error: Cannot find php-config. Please use --with-php-config=PATH
再执行
#./configure --with-php-config=/www/wdlinux/php-5.2.17/bin/php-config
make
make install
然后看探针,Socket支持   No


那里不对,请指教
作者: biyexp    时间: 2012-2-23 17:29

本帖最后由 biyexp 于 2012-2-23 17:30 编辑

补充一下在php.ini中添加了
[eaccelerator]
extension_dir="/www/wdlinux/php/lib/php/extensions/no-debug-zts-20060613"
extension="/eaccelerator.so"
extension="/sockets.so"

然后重启#service/init.d/httpd restart,看探针Socket支持   No

求指点啊
作者: admin    时间: 2012-2-23 17:37

检查/www/wdlinux/php/lib/php/extensions/no-debug-zts-20060613目录下是否有sockets.so文件
作者: biyexp    时间: 2012-2-24 09:05

本帖最后由 biyexp 于 2012-2-24 09:30 编辑

有这个文件的~~~

我把内容黏贴一下吧, 麻烦帮我看一看

#./configure --with-php-config=/www/wdlinux/php-5.2.17/bin/php-config
----------------------------------------------------------------
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 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 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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /www/wdlinux/php-5.2.17
checking for PHP includes... -I/www/wdlinux/php-5.2.17/include/php -I/www/wdlinux/php-5.2.17/include/php/main -I/www/wdlinux/php-5.2.17/include/php/TSRM -I/www/wdlinux/php-5.2.17/include/php/Zend -I/www/wdlinux/php-5.2.17/include/php/ext -I/www/wdlinux/php-5.2.17/include/php/ext/date/lib
checking for PHP extension directory... /www/wdlinux/php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /www/wdlinux/php-5.2.17/include/php
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... gawk
checking whether to enable sockets support... yes, shared
checking for struct cmsghdr... yes
checking for hstrerror... yes
checking for socketpair... yes
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 netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for ld used by cc... /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 recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) 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
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
-----------------------------------------------------------------------------------
#make
-------------------------------------------------
/bin/sh /OneKey/lanmp/php-5.2.17/ext/sockets/libtool --mode=install cp ./sockets.la /OneKey/lanmp/php-5.2.17/ext/sockets/modules
cp ./.libs/sockets.so /OneKey/lanmp/php-5.2.17/ext/sockets/modules/sockets.so
cp ./.libs/sockets.lai /OneKey/lanmp/php-5.2.17/ext/sockets/modules/sockets.la
PATH="$PATH:/sbin" ldconfig -n /OneKey/lanmp/php-5.2.17/ext/sockets/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /OneKey/lanmp/php-5.2.17/ext/sockets/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'.

-------------------------------------------
作者: biyexp    时间: 2012-2-24 09:29

#make test

----------------------------------------------------

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


=====================================================================
PHP         : /www/wdlinux/php-5.2.17/bin/php
PHP_SAPI    : cli
PHP_VERSION : 5.2.17p1
ZEND_VERSION: 2.2.0
PHP_OS      : Linux - Linux biye-Centos 2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686
INI actual  : /OneKey/lanmp/php-5.2.17/ext/sockets/tmp-php.ini
More .INIs  :  
CWD         : /OneKey/lanmp/php-5.2.17/ext/sockets
Extra dirs  :
VALGRIND    : Not used
=====================================================================
TIME START 2012-02-24 01:23:30
=====================================================================
PASS Bug 46360 - TCP_NODELAY constant (sock_get_option, sock_set_option) [tests/bug46360.phpt]
PASS IPv4 Loopback test [tests/ipv4loop.phpt]
PASS IPv6 Loopback test [tests/ipv6loop.phpt]
PASS Test parameter handling in socket_accept() [tests/socket_accept-wrongparams.phpt]
PASS ext/sockets - socket_bind - basic test [tests/socket_bind.phpt]
PASS ext/sockets - socket_bind - test with empty parameters [tests/socket_bind_params.phpt]
PASS ext/sockets - socket_close - test with empty parameters [tests/socket_close_params.phpt]
PASS Test error cases when creating a socket [tests/socket_connect_error.phpt]
PASS ext/sockets - socket_connect - test with empty parameters [tests/socket_connect_params.phpt]
SKIP Test if socket_create_listen() returns false, when it cannot bind to the port. [tests/socket_create_listen-nobind.phpt] reason: Test cannot be run as root.
PASS Test if socket_create_listen throws E_WARNING with wrong parameters. [tests/socket_create_listen-wrongparams.phpt]
PASS Test if socket binds on 31338 [tests/socket_create_listen.phpt]
PASS ext/sockets - socket_create_listen - test for empty parameters [tests/socket_create_listen_params.phpt]
PASS ext/sockets - socket_create_listen - test for used socket [tests/socket_create_listen_used.phpt]
PASS Test parameter handling in socket_create_pair() [tests/socket_create_pair-wrongparams.phpt]
PASS Test for socket_create_pair() [tests/socket_create_pair.phpt]
PASS ext/sockets - socket_create - test with empty parameters [tests/socket_create_params.phpt]
PASS ext/sockets - socket_getsockname - basic test [tests/socket_getpeername.phpt]
PASS ext/sockets - socket_getpeername_ipv4loop - basic test [tests/socket_getpeername_ipv4loop.phpt]
PASS ext/sockets - socket_getpeername_ipv6loop - basic test [tests/socket_getpeername_ipv6loop.phpt]
PASS ext/sockets - socket_getsockname - basic test [tests/socket_getsockname.phpt]
PASS Test parameter handling in socket_listen(). [tests/socket_listen-wrongparams.phpt]
PASS ext/sockets - socket_listen - test with empty parameters [tests/socket_listen_params.phpt]
PASS ext/sockets - socket_read- test with empty parameters [tests/socket_read_params.phpt]
PASS Test parameter handling in socket_select(). [tests/socket_select-wrongparams-1.phpt]
PASS Test parameter handling in socket_select(). [tests/socket_select-wrongparams-2.phpt]
PASS Test parameter handling in socket_select(). [tests/socket_select-wrongparams-3.phpt]
PASS Test parameter handling in socket_select(). [tests/socket_select-wrongparams-4.phpt]
PASS Test parameter handling in socket_select(). [tests/socket_select.phpt]
PASS Test if socket_recvfrom() receives data sent by socket_sendto() via IPv4 UDP [tests/socket_sentto_recvfrom_ipv4_udp.phpt]
PASS Test if socket_recvfrom() receives data sent by socket_sendto() via IPv6 UDP [tests/socket_sentto_recvfrom_ipv6_udp.phpt]
PASS Test if socket_recvfrom() receives data sent by socket_sendto() through a Unix domain socket [tests/socket_sentto_recvfrom_unix.phpt]
PASS Test socket_set_block return values [tests/socket_set_block-retval.phpt]
PASS Test if socket_set_block throws E_WARNING with wrong parameters. [tests/socket_set_block-wrongparams.phpt]
PASS Test socket_set_nonblock return values [tests/socket_set_nonblock-retval.phpt]
PASS Test if socket_set_nonblock throws E_WARNING with wrong parameters. [tests/socket_set_nonblock-wrongparams.phpt]
PASS ext/sockets - socket_set_block - basic test [tests/socket_set_nonblock.phpt]
SKIP Test if socket_set_option() returns 'unable to set socket option' failure for invalid options [tests/socket_set_option_error_socket_option.phpt] reason: Test cannot be run as root.
PASS Test if socket_set_option() works, option:SO_RCVTIMEO [tests/socket_set_option_rcvtimeo.phpt]
PASS Test if socket_set_option() works, option:SO_SEOLINGER [tests/socket_set_option_seolinger.phpt]
PASS Test if socket_set_option() works, option:SO_SNDTIMEO [tests/socket_set_option_sndtimeo.phpt]
FAIL ext/sockets - socket_strerror - basic test [tests/socket_strerror.phpt]
PASS ext/sockets - socket_write - test with empty parameters [tests/socket_write_params.phpt]
PASS Unix domain socket Loopback test [tests/unixloop.phpt]
=====================================================================
TIME END 2012-02-24 01:23:39

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   32
---------------------------------------------------------------------

Number of tests :   44                42
Tests skipped   :    2 (  4.5%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (  2.3%) (  2.4%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   41 ( 93.2%) ( 97.6%)
---------------------------------------------------------------------
Time taken      :    9 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
ext/sockets - socket_strerror - basic test [tests/socket_strerror.phpt]
=====================================================================

You may have found a problem in PHP.
We would like to send this report automatically to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose "s" to save the report to
a file that you can send us later.
Do you want to send this report now? [Yns]:

---------------------------------------------------------

#make install
-----------------------------------------
Installing shared extensions:     /www/wdlinux/php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613/
作者: biyexp    时间: 2012-2-27 08:51

可以帮看看么?着英文提示我看不懂。。

问题出在那里呀
作者: admin    时间: 2012-2-27 09:03

cp /www/wdlinux/php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613/sockets.so /www/wdlinux/php-5.2.17/lib/php/extensions/no-debug-zts-20060613/sockets.so
作者: biyexp    时间: 2012-2-27 17:17

谢谢了    错把no-debug-zts-20060613文件夹看成no-debug-non-zts-20060613了。

模块加载成功啦,呵呵
作者: zxympx    时间: 2014-6-16 10:01

我是菜鸟 弱弱问句 怎么进入源码目录
作者: quyu    时间: 2014-6-16 13:20

回复 10# zxympx

WDCP编译加载sockets扩展[详解]

这里有个详细解答:
http://www.tujie.net/thread-923-1-1.html




欢迎光临 WDlinux官方论坛 (http://www.wdlinux.cn/bbs/) Powered by Discuz! 7.2