Mac Protocol “https“ not supported or disabled in libcurl

问题:使用php curl https地址的时候报错cURL error 1: Protocol "https" not supported or disabled in libcurl (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

问题排查

  1. 查看curl是否支持https

  2. 再次测试 curl https://www.baidu.com

  3. curl没有问题,查看是否安装openssl扩展 php -m

  4. 查看phpinfo(),php7.4的curl扩展不支持https

  5. 下载curl-7.76.1 https://curl.se/download.html,

  6. 编译安装

  • ./configure --with-php-config=/Applications/MxSrvs/bin/php/bin/php-config --with-darwinssl, –with-darwinssl 为支持 https
  • make && make install
  1. 将刚刚编译好的curl复制到目标目录下,我是用的MxSrvs
  • cd /Applications/MxSrvs/libs/_curl
  • mv 7.70.0 mv 7.70.0_back
  • cp -r ~/code_php/curl-7.76.1 7.76.1/
  1. 重启php服务