php安装swoole扩展的方法
这篇文章主要介绍了php安装swoole扩展的方法,以OS X操作系统为例分析了swoole扩展的安装技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了php安装swoole扩展的方法。分享给大家供大家参考。具体如下:
我本机是OS X,想要安装swoole体验一下,于是:
复制代码 代码如下:
andy@AndyMacBookPro:/usr/local/webdata/github$ cd swoole-src/
andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$ git pull
Already up-to-date.
andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$ phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$ ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/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... i386-apple-darwin13.4.0
checking host system type... i386-apple-darwin13.4.0
checking target system type... i386-apple-darwin13.4.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/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... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable swoole debug... no
checking enable sockets support... no
checking enable ringbuffer shared memory pool support... no
checking enable async_mysql support... no
checking enable openssl support... no
checking swoole support... yes, shared
checking swoole support... yes, shared
checking if compiling with clang... yes
checking for cpu affinity... no
checking for ext/mysqli support... yes
checking for ext/mysqlnd support... yes
checking for accept4 in -lc... no
checking for signalfd in -lc... no
checking for timerfd_create in -lc... no
checking for eventfd in -lc... no
checking for epoll_create in -lc... no
checking for sendfile in -lc... yes
./configure: line 4740: PGSQL_INCLUDE: command not found
checking for kqueue in -lc... yes
checking for daemon in -lc... yes
checking for mkostemp in -lc... no
checking for pthread_rwlock_init in -lpthread... yes
checking for pthread_spin_lock in -lpthread... no
checking for pthread_mutex_timedlock in -lpthread... no
checking for SSL_library_init in -lssl... yes
checking for clock_gettime in -lc... no
checking for aio_read in -lc... yes
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.4.0 dyld
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
andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$ make
/bin/sh /usr/local/webdata/github/swoole-src/libtool --mode=compile cc -I. -I/usr/local/webdata/github/swoole-src -DPHP_ATOM_INC -I/usr/local/webdata/github/swoole-src/include -I/usr/local/webdata/github/swoole-src/main -I/usr/local/webdata/github/swoole-src -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/webdata/github/swoole-src/include -DHAVE_CONFIG_H -Wall -pthread -g -O2 -std=gnu89 -c /usr/local/webdata/github/swoole-src/swoole.c -o swoole.lo
mkdir .libs
cc -I. -I/usr/local/webdata/github/swoole-src -DPHP_ATOM_INC -I/usr/local/webdata/github/swoole-src/include -I/usr/local/webdata/github/swoole-src/main -I/usr/local/webdata/github/swoole-src -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/webdata/github/swoole-src/include -DHAVE_CONFIG_H -Wall -pthread -g -O2 -std=gnu89 -c /usr/local/webdata/github/swoole-src/swoole.c -fno-common -DPIC -o .libs/swoole.o
In file included from /usr/local/webdata/github/swoole-src/swoole.c:19:
In file included from ./php_swoole.h:31:
In file included from /usr/include/php/ext/spl/spl_iterators.h:27:
/usr/include/php/ext/pcre/php_pcre.h:29:10: fatal error: 'pcre.h' file not
found
#include "pcre.h"
^
1 error generated.
make: *** [swoole.lo] Error 1
andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$
到这里的时候报了一个pcre.h的报错,所以安装一下pcre.h。
好吧,其实不是没有安装pcre,我的本地 php -m已经安装了pcre了。这个错误是这样的:
复制代码 代码如下:
/usr/include/php/ext/pcre/php_pcre.h:29:10: fatal error: 'pcre.h' file not
found
#include "pcre.h"
查看php_pcre.h中的第29行:
复制代码 代码如下:
#include "pcre.h"
是这里没有找到pcre.h,那么问题是我们的操作系统环境中没有安装pcre开发包,我们就安装一下好了。
有好几种方式,可以使用brew install的方式也可以到获取源码自己编译:
brew install这种不说了,,直接brew install pcre就可以了。
另一种自己编译的方式:这里有两个版本,pcre和pcre2,swoole应该需要的是pcre吧,直接:
复制代码 代码如下:
svn co svn://vcs.exim.org/pcre/code/trunk pcre
然后,好吧,下载的源码中没有./configure,估计要自己写,所以我又改主意了,使用brew install:
复制代码 代码如下:
推荐阅读
-
Windows7下PHP开发环境安装配置图文方法
-
PHP连接SQLServer2005的实现方法(附ntwdblib.dll下载)
-
编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法
-
PHP把JPEG图片转换成Progressive JPEG的方法
-
使用VisualStudio开发php的图文设置方法
-
php防止伪造的数据从URL提交方法
-
python django框架中使用FastDFS分布式文件系统的安装方法
-
Sketchup怎么安装使用ToolsOnSurface插件? SU插件的使用方法
-
利用dropins文件夹安装eclipse插件的方法
-
ubuntu安装sublime不能输入中文的解决方法