fatal error: 'openssl/ssl.h' file not found |mac下swoole 编译安装openssl扩展

安装方式

  • pecl install swoole
    openssle yes --with-openssl-dir=/usr/local/Cellar/[email protected]/1.1.1i/
  • mkdir -p ~/build &&
    cd ~/build &&
    rm -rf ./swoole-src &&
    curl -o ./tmp/swoole.tar.gz https://github.com/swoole/swoole-src/archive/master.tar.gz -L &&
    tar zxvf ./tmp/swoole.tar.gz &&
    mv swoole-src* swoole-src &&
    cd swoole-src &&
    phpize &&
    ./configure
    --enable-openssl
    --enable-http2 &&
    make && sudo make install

建议方式

指定openssl地址

//下载swoole包
1 wget https://gitee.com/swoole/swoole/repository/archive/master.zip 
//解压
2 unzip master 
//进入源码目录
3 cd swoole 
//查看openssl安装位置
4 brew --prefix openssl 
//生成configure文件
5 phpize 
// 配置环境
6 ./configure --with-openssl-dir=/usr/local/opt/[email protected] --enable-openssl
//编译和安装
7 make && sudo make install
//检查是否成功
➜  swoole php --ri swoole
...
openssl => OpenSSL 1.1.1g  21 Apr 2020
...

你可能感兴趣的:(fatal error: 'openssl/ssl.h' file not found |mac下swoole 编译安装openssl扩展)