Composer The openssl extension is required for SSL/TLS protection

洪开诚
2023-12-01

=============================新的解决方法(较完善)=================================

    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.

   对于这个问题,我尝试使用下面的命令解决:

[plain]  view plain  copy
  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

[plain]  view plain  copy
  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

 类似资料:

相关阅读

相关文章

相关问答