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

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

异常提示信息:

bash 复制代码
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的安装路径

bash 复制代码
# 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"

生效配置

bash 复制代码
source ~/.bash_profile

重新安装:

bash 复制代码
pecl install event
相关推荐
Cosmoshhhyyy7 小时前
linux远程部署dify和mac本地部署dify
linux·运维·macos
行星0087 小时前
mac 通过homebrew 安装和使用nvm
macos·npm·node.js
奥格列的魔法拖鞋~11 小时前
Docker-LNMP架构 创建多项目- 单个ngixn代理多个PHP容器服务
nginx·docker·eureka·架构·php·lnmp
皓空揽月12 小时前
php+apache+nginx 更换域名
nginx·php·apache
我不是立达刘宁宇14 小时前
php危险函数,二.assert()[现版本已弃用]
开发语言·php
2501_9280946514 小时前
Mac电脑录屏工具 Omi录屏专家(Mac中文)
macos·mac·录屏工具·omi
森之鸟17 小时前
Mac chrome浏览器下载DevEco Studio 6.0.0 Beta2失败
前端·chrome·macos
liulanba18 小时前
NAT 和 PNAT
开发语言·php
FairGuard手游加固1 天前
版本更新!FairGuard-Mac加固工具已上线!
macos