首页 > php教程 > php手册 > 正文

php安装swoole扩展的方法

php中文网
发布: 2016-06-06 20:06:19
原创
1221人浏览过

这篇文章主要介绍了php安装swoole扩展的方法,以OS X操作系统为例分析了swoole扩展的安装技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了php安装swoole扩展的方法。分享给大家供大家参考。具体如下:

我本机是OS X,想要安装swoole体验一下,于是:

复制代码 代码如下:

立即学习PHP免费学习笔记(深入)”;

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了。这个错误是这样的:

复制代码 代码如下:

立即学习PHP免费学习笔记(深入)”;

/usr/include/php/ext/pcre/php_pcre.h:29:10: fatal error: 'pcre.h' file not
      found
#include "pcre.h"

查看php_pcre.h中的第29行:

复制代码 代码如下:

立即学习PHP免费学习笔记(深入)”;

#include "pcre.h"

乐活途购物分享社区
乐活途购物分享社区

beta v1.1版本为第一个版本,简单的整合了基础功能,各位站长拿到程序后,不要纠结后台的功能简单,后续将不断更新扩展。在beta v1.1版本使用过程中遇到什么问题,请登录 www.loftto.com 进行反馈! 安装说明######重要提醒:程序不支持二级目录安装,请使用一级目录或二级目录绑定!#第一步,确定你的服务器支持PHP+mysql。#第二步,确定你的服务器开启了gd库。#第三步,

乐活途购物分享社区 0
查看详情 乐活途购物分享社区

是这里没有找到pcre.h,那么问题是我们的操作系统环境中没有安装pcre开发包,我们就安装一下好了。

有好几种方式,可以使用brew install的方式也可以到获取源码自己编译:

brew install这种不说了,,直接brew install pcre就可以了。

另一种自己编译的方式:这里有两个版本,pcre和pcre2,swoole应该需要的是pcre吧,直接:

复制代码 代码如下:

立即学习PHP免费学习笔记(深入)”;

svn co svn://vcs.exim.org/pcre/code/trunk pcre

然后,好吧,下载的源码中没有./configure,估计要自己写,所以我又改主意了,使用brew install:

复制代码 代码如下:

立即学习PHP免费学习笔记(深入)”;

相关标签:
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号