linux swoole4安装,swoole4 安装 - mickelfeng的个人空间 - OSCHINA - 中文开源技术交流社区...

本文详细介绍了如何在Ubuntu上安装PHP7.1.10、http2、hiredis以及Swoole扩展4.0.1。首先,通过tar命令解压并安装nghttp2和hiredis,然后使用phpize配置并编译Swoole,特别提到在4.0.1版本中--enable-coroutine选项的改变。最后,通过php --ri swoole验证安装成功。
摘要由CSDN通过智能技术生成

PHP 7.1.10 (cli) (built: Oct  9 2017 10:44:28) ( NTS )

1.安装http2

a.下载  nghttp2, 解压 sudo tar -zxvf  nghttp2-1.32.0.tar.xz

b.进入目录  nghttp2-1.32.0

sudo ./configure

sudo make && make install

2.安装hiredis

a.下载hiredis  解压 sudo tar -zxvf hiredis-0.13.3.tar.gz

b.进入目录hiredis-0.13.3,执行 sudo make -j && sudo make install

3.安装swoole4.0

a.下载swoole 4.0     sudo wget https://pecl.php.net/get/swoole-4.0.1.tgz

b.进入swoole目录,执行命令 /usr/local/php/bin/phpize

c.编译 sudo ./configure \

--with-php-config=/usr/local/php/bin/php-config \

--enable-openssl  \

--enable-http2  \

--enable-async-redis \

--enable-sockets \

--enable-mysqlnd

4.0.1或更高版本去除了--enable-coroutine编译选项, 改为动态配置

enable_coroutine动态配置请见文档

enable_coroutine 选项相当于在回调中关闭以前版本的SW_COROUTINE宏开关, 关闭时在回调事件中不再创建协程,但是保留用户创建协程的能力。

当enable_coroutine设置为true时,底层自动在onRequest回调中创建协程,开发者无需自行使用go函数创建协程

当enable_coroutine设置为false时,底层不会自动创建协程,开发者如果要使用协程,必须使用go自行创建协程,如果不需要使用协程特性,则处理方式与1.x是100%一致的

注意:在b这一步,哪里出错就安装那里,假如openssl没有就安装openssl,然后查看ls /usr/local/include/openssl 有无,

没有就ln -s /usr/local/openssl/1.0.2o_1/include/openssl /usr/local/include/  (建立软连接过去就可以了)

d.安装:sudo make && make install

e.查看php -m  (查看php扩展)

root1@ubuntu:/opt/swoole-4.0.1$ php --ri swoole

swoole

swoole support => enabled

Version => 4.0.1

Author => tianfeng.han[email: mikan.tenny@gmail.com]

coroutine => enabled

epoll => enabled

eventfd => enabled

timerfd => enabled

signalfd => enabled

cpu affinity => enabled

spinlock => enabled

rwlock => enabled

async redis client => enabled

async http/websocket client => enabled

sockets => enabled

openssl => enabled

http2 => enabled

Linux Native AIO => enabled

pcre => enabled

zlib => enabled

mutex_timedlock => enabled

pthread_barrier => enabled

futex => enabled

mysqlnd => enabled

Directive => Local Value => Master Value

swoole.aio_thread_num => 2 => 2

swoole.display_errors => On => On

swoole.use_namespace => On => On

swoole.use_shortname => On => On

swoole.fast_serialize => Off => Off

swoole.unixsock_buffer_size => 8388608 => 8388608

下载 4.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值