广告
返回顶部
首页 > 资讯 > 后端开发 > PHP编程 >mac 编译安装php7.4 后 开启openssl扩展错误记录
  • 682
分享到

mac 编译安装php7.4 后 开启openssl扩展错误记录

linux运维服务器 2023-09-01 05:09:47 682人浏览 独家记忆
摘要

cd 到PHP源码目录下ext下的openssl然后phpize 检测 ./configure --with-php-config=/usr/local/php7/bin/php-config --with-openssl  错误1  Pa

cd 到PHP源码目录下ext下的openssl然后phpize

检测

./configure --with-php-config=/usr/local/php7/bin/php-config --with-openssl

 错误1

 Package requirements (openssl >= 1.0.1) 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.

解决1

首先确认是否已经安装了 openssl version 如果未安装,brew install openssl。 

OpenSSL 1.1.1q  5 Jul 2022 

  

vi ~/.bash_profile 追加PKG_CONFIG_PATH 路径和声明openssl lib/include 的路径

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkGConfigexport PKG_CONFIG_PATHexport OPENSSL_LIBS="-L/usr/local/Cellar/openssl@1.1/1.1.1q/lib"export OPENSSL_CFLAGS="-I/usr/local/Cellar/openssl@1.1/1.1.1q/include"export PATH=/usr/local/opt/openssl@1.1/bin:$PATHexport LDFLAGS=-L/usr/local/opt/openssl@1.1/libexport CPPFLAGS=-I/usr/local/opt/openssl@1.1/include

注册 openssl 到 pkgconfig 中

# 查看 openssl 是否在 pkgconfig 中pkg-config --list-all | grep openssl# 如果 pkgconfig 中没有 openssl 包 则手动建立 或者 尝试 brew unlink/link 重建cd /usr/local/Cellar/openssl@1.1/1.1.1d/lib/pkgconfigln -s `pwd`/openssl.pc /usr/local/lib/pkgconfig

错误2

108 warnings and 1 error generated.

make: *** [ext/openssl/openssl.lo] Error 1

这个错误主要是 openssl 版本 php版本不兼容,brew install openssl 默认安装的是最新openssl@3版本,发生以上错误

由于Debian Stretch默认使用OpenSSL 1.1.0。PHP 5.6 与更高版本的 OpenSSL 不兼容。这是一个 PHP 问题,但不确定它们是否会修复。

解决2

找到问题所在就好解决了,brew install openssl@1.1 安装openssl低版本就可以了。php7.4 一下都不与openssl@3兼容,php8 未知。

来源地址:https://blog.csdn.net/weixin_40896800/article/details/126377185

--结束END--

本文标题: mac 编译安装php7.4 后 开启openssl扩展错误记录

本文链接: https://www.lsjlt.com/news/387544.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作