V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tg11
V2EX  ›  PHP

救助, Mac 系统下 composer 报错 Protocol "https" not supported or disabled in libcurl

  •  
  •   tg11 · 2021-04-06 13:20:08 +08:00 · 2223 次点击
    这是一个创建于 1077 天前的主题,其中的信息可能已经有所发展或是发生改变。

    composer create 的时候,报错

    [Composer\Downloader\TransportException]
    Protocol "https" not supported or disabled in libcurl
    

    上网查了后说是没有 OpenSSL,但是我已经安装过 OpenSSL 了,curl -V 查看也有 https 支持.

    curl 7.64.1 (x86_64-apple-darwin20.3.0) libcurl/7.64.1 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 librtmp/2.3
    Release-Date: 2019-03-27
    Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
    Features: AsynchDNS brotli HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
    
    6 条回复    2021-04-17 18:20:22 +08:00
    limingxinleo
        1
    limingxinleo  
       2021-04-06 13:22:47 +08:00
    php --ri openssl
    tg11
        2
    tg11  
    OP
       2021-04-06 13:30:17 +08:00
    @limingxinleo
    ```
    openssl

    OpenSSL support => enabled
    OpenSSL Library Version => OpenSSL 1.1.1g 21 Apr 2020
    OpenSSL Header Version => OpenSSL 1.1.1g 21 Apr 2020
    Openssl default config => /Applications/MxSrvs/libs/_openssl/1.1.1g/ssl/openssl.cnf

    Directive => Local Value => Master Value
    openssl.cafile => no value => no value
    openssl.capath => no value => no value
    ```
    执行后显示这个。但是 composer 还是报 Protocol "https" not supported or disabled in libcurl
    ben1024
        3
    ben1024  
       2021-04-06 14:38:59 +08:00
    重装下 curl 试试
    echodone
        4
    echodone  
       2021-04-13 11:15:18 +08:00
    /Applications/MxSrvs/bin/composer/bin/composer.phar require xxx
    echodone
        5
    echodone  
       2021-04-13 11:16:05 +08:00
    试试这样行不行
    liuxu
        6
    liuxu  
       2021-04-17 18:20:22 +08:00
    curl 说了不算,老夫不信还能有这么奇怪的问题

    找到你 php 的 curl.so 模块,然后 ldd curl.so
    liuxu@liuxu-Inspiron-7559:~$ ldd /usr/lib/php/20190902/curl.so
    libcurl.so.4 => /lib/x86_64-linux-gnu/libcurl.so.4 (0x00007f9491b3d000)
    libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f94917cb000)

    然后看看你的 libcurl.so.4
    liuxu@liuxu-Inspiron-7559:~$ ldd /lib/x86_64-linux-gnu/libcurl.so.4
    libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f300fde8000)

    最后检查一下 php 的配置文件,php --ini 找到 php.ini
    liuxu@liuxu-Inspiron-7559:~$ php --ini
    Configuration File (php.ini) Path: /etc/php/7.4/cli
    Loaded Configuration File: /etc/php/7.4/cli/php.ini

    liuxu@liuxu-Inspiron-7559:~$ grep "disable_" /etc/php/7.4/cli/php.ini
    disable_functions =
    disable_classes =


    再不行用 vagrant 装 ubuntu 吧,mac 做开发屁事多
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5914 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:33 · PVG 10:33 · LAX 19:33 · JFK 22:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.