Composer install squizlabs/php_codesniffer PHP 7.4 on Windows 10 安装失败

发布于 2023-02-12 04:57:26

我在 Windows 10 和 PHP 7.4.4 上使用 Composer v. 1.10.20 安装 squizlabs/php_codesniffer 时出现以下错误:


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

我该如何解决?如何在 Windows 10 上安装 openssl 扩展?

我尝试使用命令安装 squizlabs/php_codesniffer=* composer library: composer.bat global require squizlabs/php_codesniffer=* 但失败并出现上面的错误。 我希望通过安装和启用缺少的库或包来修复错误。

查看更多

1楼回答 2023-02-04
  1. 导航到您的 php 文件夹并打开 php.ini 文件

  2. 去掉分号

    //before

    ;扩展名=openssl

    //after

    扩展名=openssl

  3. 保存存档

  4. 打开新终端并测试它现在应该可以工作

请登录后再发布答案,点击登录