1. 程式人生 > >Composer The openssl extension is required for SSL/TLS protection

Composer The openssl extension is required for SSL/TLS protection

=============================新的解決方法(較完善)=================================

    Composer 是 PHP5以上 的一個依賴管理工具。它允許你申明專案所依賴的程式碼庫,它會在你的專案中為你安裝他們。Composer 不是一個包管理器。是的,它涉及 "packages" 和 "libraries",但它在每個專案的基礎上進行管理,在你專案的某個目錄中(例如 vendor)進行安裝。預設情況下它不會在全域性安裝任何東西。因此,這僅僅是一個依賴管理。

    安裝好Composer時通過composer install,發現沒有正常安裝,而是提示:

  [Composer\Exception\NoSslException]
  The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error , at your own risk, by setting the 'disable-tls' option to true.

   對於這個問題,我嘗試使用下面的命令解決:

  1. composer config -g -- disable-tls true  
    然而出現了另外的問題:
  [Composer\Downloader\TransportException]
  Your configuration does not allow connections to http://packagist.org/packages.json. See https://getcomposer.org/doc/06-config.md#secure-http for details.

    所以需要再次進行設定,禁用SSL

  1. composer config secure-http false  
  2.     composer config -g secure-http false  

    之後,一部分可以正常安裝了,還有一部分提示超過300stimeout,所以對時間進行設定:

    增加COMPOSER_PROCESS_TIMEOUT,通過命令composer config --list看到預設是300s,然後通過命令composer config -g process-timeout 600增加COMPOSER_PROCESS_TIMEOUT至600s。

    至此,Composer能夠正常執行。

================================================================

====Executing command 'composer update  "topthink/framework" --no-interaction --no-ansi'==== You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug   [Composer\Exception\NoSslException]                                             The openssl extension is required for SSL/TLS protection but is not availab     le. If you can not enable the openssl extension, you can disable this error     , at your own risk, by setting the 'disable-tls' option to true.              update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]... ====composer command completed with exit code 1====

解決方法:composer config -g -- disable-tls true

或者開啟php的ssl開啟

=================================================


來源:http://www.rabbit8.cn/576.html