• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

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

武飞扬头像
司江龙
帮助13

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 

学新通  

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

  1.  
    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
  2.  
    export PKG_CONFIG_PATH
  3.  
    export OPENSSL_LIBS="-L/usr/local/Cellar/openssl@1.1/1.1.1q/lib"
  4.  
    export OPENSSL_CFLAGS="-I/usr/local/Cellar/openssl@1.1/1.1.1q/include"
  5.  
    export PATH=/usr/local/opt/openssl@1.1/bin:$PATH
  6.  
    export LDFLAGS=-L/usr/local/opt/openssl@1.1/lib
  7.  
    export CPPFLAGS=-I/usr/local/opt/openssl@1.1/include

2、注册 openssl 到 pkgconfig 中

  1.  
    # 查看 openssl 是否在 pkgconfig 中
  2.  
    pkg-config --list-all | grep openssl
  3.  
     
  4.  
    # 如果 pkgconfig 中没有 openssl 包 则手动建立 或者 尝试 brew unlink/link 重建
  5.  
    cd /usr/local/Cellar/openssl@1.1/1.1.1d/lib/pkgconfig
  6.  
    ln -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 未知。

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhfiahga
系列文章
更多 icon
同类精品
更多 icon
继续加载