问题描述
composer create-project flarum/flarum . --stability=beta
我尝试运行这个命令,但它给了我这个错误.
I try to run this command, but it gave me this error.
[RuntimeException]
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.
我尝试将extension=php_openssl.dll"添加到php.ini",但仍然出现此错误
I tried to add "extension=php_openssl.dll" to "php.ini", but it still got this error
推荐答案
我也遇到了同样的错误.我通过关闭 Composer 的 TLS 来修复它,它不安全,但我承担了我的开发机器的风险.
The same error occurred to me. I fixed it by turning off TLS for Composer, it's not safe but I assumed the risk on my develop machine.
试试这个:
composer config -g -- disable-tls true
然后重新运行您的 Composer.它对我有用!
and re-run your Composer. It works to me!
但它不安全并且不推荐用于您的服务器.官网说:
But it's unsecure and not recommended for your Server. The official website says:
如果设置为 true,所有 HTTPS URL 将改为使用 HTTP 进行尝试,并且不执行网络级加密.启用此功能存在安全风险,不建议这样做.更好的方法是在 php.ini 中启用 php_openssl 扩展.
如果您不想在您的机器/服务器中启用不安全层,那么设置您的 php 以启用 openssl,它也可以工作.确保已安装 PHP Openssl 扩展并在 php.ini 文件中启用它.
If you don't want to enable unsecure layer in your machine/server, then setup your php to enable openssl and it also works. Make sure the PHP Openssl extension has been installed and enable it on php.ini file.
要启用 OpenSSL,请在 php.ini 文件中添加或查找并取消注释此行:
To enable OpenSSL, add or find and uncomment this line on your php.ini file:
Linux/OSx:
extension=php_openssl.so
Windows:
extension=php_openssl.dll
如果需要,重新加载您的 php-fpm/web-server!
And reload your php-fpm / web-server if needed!
更新:
从 PHP 7.4 开始,扩展名为 extension=openssl
(适用于 Windows).
As of PHP 7.4 the extension is named extension=openssl
(known for Windows).
这篇关于SSL/TLS 保护需要 openssl 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!