tg11
V2EX  ›  PHP

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

  •  
  •   tg11 · Apr 6, 2021 · 3315 views
    This topic created in 1880 days ago, the information mentioned may be changed or developed.

    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 replies    2021-04-17 18:20:22 +08:00
    limingxinleo
        1
    limingxinleo  
       Apr 6, 2021
    php --ri openssl
    tg11
        2
    tg11  
    OP
       Apr 6, 2021
    @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  
       Apr 6, 2021
    重装下 curl 试试
    echodone
        4
    echodone  
       Apr 13, 2021
    /Applications/MxSrvs/bin/composer/bin/composer.phar require xxx
    echodone
        5
    echodone  
       Apr 13, 2021
    试试这样行不行
    liuxu
        6
    liuxu  
       Apr 17, 2021
    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 做开发屁事多
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2677 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 02:05 · PVG 10:05 · LAX 19:05 · JFK 22:05
    ♥ Do have faith in what you're doing.