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
相关推荐
晚枫~7 小时前
不同浏览器在Windows和Mac上的跨域配置方法
windows·macos
亿坊电商7 小时前
PHP框架的资源管理机制如何优雅适配后台任务?
开发语言·php
denggun123458 小时前
Xcode的App Thinning Size Report分析包体积
macos·蓝桥杯·xcode
onebound_noah9 小时前
电商图片搜索:技术破局与商业落地,重构“视觉到交易”全链路
大数据·前端·网络·人工智能·重构·php
JSON_L10 小时前
Fastadmin部署访问404问题
php·fastadmin
代码狂想家12 小时前
Rust 命令行密码管理器工具开发
开发语言·rust·php
醇氧12 小时前
MAC安装 Notepad Next
macos
遇见火星1 天前
Linux 网络性能测试实战:用 iperf3 精准测出真实带宽与丢包率
linux·网络·php·iperf3
DKunYu1 天前
5.网络原理之TCP_IP
网络·tcp/ip·php
ooooooctober1 天前
PHP代码审计框架性思维的建立
android·开发语言·php