【问题标题】:Enabling SSL for composer install在 Laragon 中为 composer 安装启用 SSL,PHP 7.4
【发布时间】:2023-01-12 01:22:36
【问题描述】:

我知道这个问题在这个网站上到处都是,但所有的解决方案都不适用于我。

运行时出现此错误作曲家安装:

In Factory.php line 650:

  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.

我不知道它从哪里获取 Factory.php,但它不在我的项目目录中。

我做了所有建议的解决方案。我将 PHP 的 php.ini-development 文件重命名为 php.ini,并取消注释以下内容:

extension=openssl

因为我在 Windows 上,这也是:

extension_dir = "ext"

我还通过 Laragon 菜单启用了 SSL > Apache > SSL > 启用

我的 php.ini 文件位于我的 laragon 文件夹中,如下所示:

C:\laragon\bin\php\PHP7\php.ini

然后我注意到一件事:当我右键单击 Laragon 的菜单并转到 php.ini 时,它说没有找到 php.ini 文件(即使它位于正确的位置。)如 the attached photo 所示。

当所有这些都不起作用时,我看到了另一个建议的解决方案,它说将 php.ini 文件也添加到 Laragon 中的 Apache 目录中,如下所示:

C:\laragon\bin\apache\httpd-2.4.54-win64-VS16\bin\php.ini

请注意,我每次都重新加载 Apache。

而且我仍然收到错误。

可能是什么问题?我不想禁用-tls而且我不知道 Factory.php 文件是什么。

任何帮助表示赞赏。谢谢。

编辑:我也尝试卸载并重新安装 Laragon。没有运气。

【问题讨论】:

    标签: php laravel apache composer-php laragon


    【解决方案1】:

    我认为在这种情况下您缺少的是您的 PHP 实例的证书。

    您可以直接从以下地址下载此证书文件:CURL's site

    之后你需要做的就是在你的文件文件。特别是 [curl][openssl] 就在 [curl] 之后。

    您需要做的是将 cacert.pem 文件保存在一个位置,最好是在您的 Web 服务器根目录中的一个目录中,或者您喜欢的位置,并使用绝对目录进行下面的配置。

    [curl]
    ; A default value for the CURLOPT_CAINFO option. This is required to be an
    ; absolute path.
    curl.cainfo = "absolute location of where you saved the cacert.pem file"
    
    [openssl]
    ; The location of a Certificate Authority (CA) file on the local filesystem
    ; to use when verifying the identity of SSL/TLS peers. Most users should
    ; not specify a value for this directive as PHP will attempt to use the
    ; OS-managed cert stores in its absence. If specified, this value may still
    ; be overridden on a per-stream basis via the "cafile" SSL stream context
    ; option.
    openssl.cafile= "absolute location of where you saved the cacert.pem file"
    

    保存 php.ini 文件,重新启动服务器并重试。这应该可以解决您的问题。

    【讨论】:

      猜你喜欢
      • 2023-02-26
      • 2021-08-29
      • 1970-01-01
      • 2022-11-04
      • 2022-06-23
      • 1970-01-01
      • 2014-08-21
      • 2020-05-22
      • 2022-06-12
      相关资源
      最近更新 更多