php安装扩展event 提示 No package ‘openssl‘ found 解决方法

11 篇文章 0 订阅

在使用pecl编译安装最新版event模块的时候提示 No package 'openssl' found , 可是本机是安装了openssl的, 编译时找不到, 大概率就是环境配置的问题了, 增加 OPENSSL_CFLAGS OPENSSL_LIBS环境变量即可解决. 

异常提示信息:

checking for openssl >= 1.0.2... no
configure: error: Package requirements (openssl >= 1.0.2) were not met:

No package 'openssl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/event/configure --with-php-config=/usr/local/opt/php/bin/php-config --enable-event-debug=yes --enable-event-sockets=yes --with-event-libevent-dir=/usr --with-event-pthreads --with-event-extra --with-event-openssl --with-event-ns=no --with-openssl-dir' failed

解决方法:

在 ~/.bash_profile 文件中增加以下环境变量配置,  注意将 /usr/local/opt/openssl@3 替换为你自己的openssl的安装路径

# add openssl lib to FLAGS
export PATH="/usr/local/opt/openssl@3/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
# 新版本需要的变量
export OPENSSL_CFLAGS="-I/usr/local/opt/openssl@3/include"
export OPENSSL_LIBS="-L/usr/local/opt/openssl@3/lib"

生效配置

source ~/.bash_profile

重新安装:

pecl install event

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值