pecl安装swoole扩展怎么开启openssl大屏查看

发布于:2020年06月08日 已被阅读

pecl安装swoole扩展怎么开启openssl

Swoole / 更新于  / 2 条评论

这是一篇基础知识补习文章,大多数新手在安装 Swoole 扩展时,都只会使用 pecl 进行安装,还要增加一些编译参数,比如 openssl

使用命令进行安装:

pecl install swoole

在使用 pecl 进行安装时有几个问答选项

enable sockets supports? [no] : 
enable openssl support? [no] : 
enable http2 support? [no] : 
enable mysqlnd support? [no] :

这些是用于开启某些特性,比如 openssl 是来启用 SSL 支持,大多数新手在这里都会选择 yes,之后就开始编译了

结果发现报错了:error "Enable openssl support, require openssl library."(具体的错误信息就不详细写了,大概是这样)意思就是说你开启 openssl,常规路径下没有找到,需要你手动指定 openssl 库的路径

或者 fatal error: 'openssl/ssl.h' file not found

这个意思是你没有加 openssl 库的路径或者指定 openssl 库的路径不对,缺少头文件

那么在 pecl 安装的时候怎么开启添加这个路径呢?不是只能 yes 或者 no 吗?

答案是当然可以添加的,我们可以在 yes 后面跟上路径参数: --with-openssl-dir=/opt/openssl/,替换为你的 openssl 库路径

就是这样的:

enable sockets supports? [no] : yes
enable openssl support? [no] : yes --with-openssl-dir=/usr/include/openssl/
enable http2 support? [no] : no
enable mysqlnd support? [no] : yes

下面我们就可以看到我们的编译参数:

building in /tmp/pear/temp/pear-build-rootVseYYu/swoole-4.4.8
running: /tmp/pear/temp/swoole/configure --with-php-config=/usr/local/php/bin/php-config --enable-sockets=yes --enable-openssl=yes --with-openssl-dir=/usr/include/openssl --enable-http2=no --enable-mysqlnd=yes

这样编译完成后就可以了

# php --ri swoole

swoole

Swoole => enabled
Author => Swoole TeamVersion => 4.4.8
Built => Oct 17 2019 11:18:01
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.0.2k-fips  26 Jan 2017
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608




沈唁志,一个PHPer的成长之路!

任何个人或团体,未经允许禁止转载本文:《pecl 安装 swoole 扩展怎么开启 openssl》,谢谢合作!


最新发布
linux下svn提交忽略某些文件... (173)
使用批处理来批量更新、提交SVN... (135)
linux查看目录文件大小命令 (145)
linux tar打包压缩排除某个... (134)
Linux tar压缩和解压 (192)
SVN子命令add用法浅析 (130)
热门博文
网友FBI探案:马蓉iPad惊人发现... (43343)
霍金携手俄罗斯富豪耗资1亿美元寻找外... (4746)
如何才能查看PHP内置函数源代码... (1209)
微信支付开发当前URL未注册的解决方... (573)
《谁为爱情买单》中的经典面试 ... (441)
让虚拟主机也用上SVN:适用于个人的... (394)
精华博文
[推荐]Centos7 安装配置 SVN (157)
easyswoole框架安装 (173)
php开启pecl的支持(推荐) (157)
1-10个恋爱表现:男朋友爱你程度到... (164)
女生喜欢你的10个程度,到第六个就可... (141)
Eclipse 没有Server选项... (211)
友情链接
我来忙 (110)