php 您必须启用 openssl 扩展才能通过 https 下载文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14291151/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 07:00:50  来源:igfitidea点击:

You must enable the openssl extension to download files via https

phpsslopensslzend-framework2composer-php

提问by Uttam Dutta

I wanted to install Zend Framework 2. So I downloaded the skeleton application. As mentioned in the ZF2 manual, we have to issue the command

我想安装 Zend Framework 2。所以我下载了骨架应用程序。正如ZF2手册中提到的,我们必须发出命令

php composer.phar install 

Inside the skeleton.

骨架内部。

But I'm getting an error

但我收到一个错误

You must enable the openssl extension to download files via https

您必须启用 openssl 扩展才能通过 https 下载文件

Then I enabled the ssl_module in my wamp, I checked the php_ini file and I can see the following line

然后我在我的 wamp 中启用了 ssl_module,我检查了 php_ini 文件,我可以看到以下行

extension=php_openssl.dll

扩展=php_openssl.dll

Still I'm getting the same error. Anybody having any clue what I missed out?

我仍然遇到同样的错误。有人知道我错过了什么吗?

回答by BorisS

PHP CLI SAPI is using different php.inithan CGI or Apache module.

PHP CLI SAPI 使用的不同于php.iniCGI 或 Apache 模块。

Find line ;extension=php_openssl.dllin wamp/bin/php/php#.#.##/php.iniand uncomment it by removing the semicolon (;) from the beginning of the line.

查找线路;extension=php_openssl.dllwamp/bin/php/php#.#.##/php.ini,并通过移除分号(取消注释;从行的开头)。

回答by Duramba

Verify you are editing the correct php.ini file.

验证您正在编辑正确的 php.ini 文件。

Reference: https://github.com/composer/composer/issues/1440

参考:https: //github.com/composer/composer/issues/1440

"WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI. You need to modify C:\wamp\bin\php\php-X.Y.Z\php.ini to enable it for the CLI."

“WAMP 在 CLI 和 Apache 中使用不同的 php.ini 文件。当您通过 WAMP UI 启用 php_openssl 时,您是为 Apache 而不是 CLI 启用它。您需要修改 C:\wamp\bin\php\php- XYZ\php.ini 为 CLI 启用它。”

回答by Adam Kopciński

make sure you have correct path to extension folder

确保您有正确的扩展文件夹路径

extension_dir = "ext"

extension_dir = "ext"

by default it is commented with ; character

默认情况下,它被注释为 ; 特点

回答by Freddy Duarte

I also had the same issue while playing around Zend Framework 2 and composer. I'm using PHP 5.4 (installed via macports) and my solution was to install openssl for PHP 5.4 via macports as well.

我在玩 Zend Framework 2 和 composer 时也遇到了同样的问题。我正在使用 PHP 5.4(通过 macports 安装),我的解决方案是也通过 macports 为 PHP 5.4 安装 openssl。

sudo port install php54-openssl

回答by Athlan

I have faced this problem, but configuging openssl (also for cli) did not help.

我遇到过这个问题,但配置 openssl(也适用于 cli)并没有帮助。

I have updated composer and this sloved my problem.

我已经更新了作曲家,这解决了我的问题。

Just type:

只需输入:

$ php composer.phar self-update

or

或者

$ composer selfupdate

Good luck!

祝你好运!

回答by Andrew Koper

I use XAMPP. In C:\xampp\php\php.ini, the entry for openssl did not exist, so I added "extension=php_openssl.dll" on line 989, and composer worked.

我使用 XAMPP。在 C:\xampp\php\php.ini 中,openssl 的条目不存在,所以我在第 989 行添加了“extension=php_openssl.dll”,并且 composer 工作了。

回答by Mohammed Saqib Rajput

You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :

您需要在两个文件(php 和 apache)中启用“extension=php_openssl.dll”。我的电脑文件路径是这些:

  1. C:\wamp\bin\php\php5.3.13\php.ini

  2. C:\wamp\bin\apache\apache2.2.22\bin\php.ini

  1. C:\wamp\bin\php\php5.3.13\php.ini

  2. C:\wamp\bin\apache\apache2.2.22\bin\php.ini

回答by adang

Uttam, if your issue is not solved then try the follwoing 3 step approach. It worked for me as I had exactly same issue.

Uttam,如果您的问题没有解决,请尝试以下 3 步方法。它对我有用,因为我遇到了完全相同的问题。

step1: click on wamp tray icon.

步骤 1:单击 wamp 托盘图标。

step2: goto menu apache->apache modules

步骤 2:转到菜单 apache->apache 模块

step3: click on menu item "ssl_module"

第三步:点击菜单项“ssl_module”

it will automatically restart wamp. if wamp not restarted automatically then restart it through wamp tray menu-> Restart All services. After restart confirm that "ssl_module" coming as ticked under menu apache->apache modules

它会自动重启wamp。如果 wamp 未自动重新启动,则通过 wamp 托盘菜单-> 重新启动所有服务重新启动它。重启后确认“ssl_module”在菜单apache->apache modules下打勾

after that just attempt the php composer.phar install from going through the response shared by you, php.ini file contains extension=php_openssl.dll and the php/ext directory also have file "php_openssl.dll"

之后,通过您共享的响应尝试安装 php composer.phar,php.ini 文件包含 extension=php_openssl.dll 并且 php/ext 目录也有文件“php_openssl.dll”

good luck

祝你好运

回答by karlisup

The Valery's answer helped me: https://stackoverflow.com/a/14265815/492457

Valery 的回答对我有帮助:https: //stackoverflow.com/a/14265815/492457

WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI. You need to modify C:\wamp\bin\php\php-5.4.3\php.ini to enable it for the CLI.

WAMP 在 CLI 和 Apache 中使用不同的 php.ini 文件。当您通过 WAMP UI 启用 php_openssl 时,您是为 Apache 而不是 CLI 启用它。您需要修改 C:\wamp\bin\php\php-5.4.3\php.ini 来为 CLI 启用它。

回答by codarrior

Make sure that you update your php.inifor CLI. For my case this was C:\wamp\bin\php\php5.4.3\php.iniand uncomment extension=php_openssl.dllline.

确保您更新了php.inifor CLI。就我而言,这是C:\wamp\bin\php\php5.4.3\php.ini取消注释extension=php_openssl.dll行。