安装 Composer OpenSSL 问题

问题描述 投票:0回答:3

我正在尝试安装

composer
但是当我去安装它时出现此错误:

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl

我目前有

php 5.4.31
并且正在运行
WAMP2.2
我已经检查了
php.ini
中的
bin/php/php5.4.31/
文件并确保以下行未注释:

extension=php_openssl.dll

错误仍然解决,但我不知道如何修复它。正如我所想,通过取消注释该行,它将被启用。

此外,当我在终端窗口中运行此命令时

php --ini
我收到以下消息:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\php_openssl.dll' - The specified module could not be found

php laravel openssl composer-php
3个回答
49
投票

如果您是 Windows 用户,请确保在 php.ini 文件中取消注释此行:

 extension_dir = "ext"

它确保 PHP 从它自己的 ext 库中获取扩展。


15
投票

@Javacadabra,像 php_openssl.dll 这样的扩展将位于 php/ext/ 目录下,您可以在配置文件中修复此路径,或者可以将该特定文件从 php/ext 目录复制到 php 目录。

在你的情况下它将是 c:\php xt


0
投票

针对面临相同问题的人的快速检查列表:

 Before any step if you have any apache running with this PHP version, stop it.

  1. 在确切的 php 版本目录中检查是否有“php.ini”,有时它会丢失,因此您可以复制“php.ini-development”并将其重命名为“php.ini”。
  2. 检查“php.ini”中的扩展名是否未注释 - 查找
  3. ;extension=openssl
    并删除“;”从行首开始
  4. 检查 php.ini 中扩展的路径是否正确(其中带有“extension_dir”的行应取消注释 - 行首处不带“;”
; https://php.net/extension-dir
;extension_dir = "./"
; On windows:
;extension_dir = "ext"
  1. 仔细检查“PATH”中的环境变量是否具有指向确切 php 变量的正确路径(有时可能会更改,例如由于需要不同版本的项目)
© www.soinside.com 2019 - 2024. All rights reserved.