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


    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. # 如果 pkgconfig 中没有 openssl 包 则手动建立 或者 尝试 brew unlink/link 重建
    4. cd /usr/local/Cellar/openssl@1.1/1.1.1d/lib/pkgconfig
    5. 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 未知。

  • 相关阅读:
    C++的继承(十):虚函数和Debug
    数据库的基本概念
    都 2022 年了,你真的会用 Python 的 pip 吗?
    C++指针
    ubuntu18下安装coova-chilli
    第二章第六节 ST图与迭代优化
    Ceph入门到精通-C++入门知识点
    openfoam 智能指针探索
    tomcat 启用https加密码访问
    Java – 从资源文件夹中读取文件
  • 原文地址:https://blog.csdn.net/weixin_40896800/article/details/126377185