php 安装 swoole 扩展

1、官网下载swoole

http://pecl.php.net/package/swoole

git clone https://gitee.com/swoole/swoole.git 

2、安装swoole前必须保证系统已经安装了下列软件

php-5.3.10 或更高版本
gcc-4.4 或更高版本
make
autoconf 需安装m4  安装perl依赖 yum groupinstall perl*
pcre (centos系统可以执行命令:yum install pcre-devel)

3、编译安装

cd swoole
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make 
make install

4、安装hiredis

下载:https://github.com/redis/hiredis/releases
make -j
sudo make install
sudo ldconfig

5、重新编译swoole

./configure --enable-async-redis --with-php-config=/usr/local/php/bin/php-config
make clean
make -j
sudo make install

6、查看是否安装成功

php --ri swoole 

out:

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
Linux Native AIO => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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

注:php -m 中swoole扩展消失解决办法

vi ~/.bash_profile
在最后一行添加
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

最后再运行
source ~/.bash_profile

 

转载于:https://my.oschina.net/xiaoerit/blog/1845712

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值