composer create-project flarum/flarum . --stability=beta
我尝试运行这个命令,但它给了我这个错误。
[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”,但仍然出现此错误
最佳答案
同样的错误发生在我身上。我通过关闭 Composer 的 TLS 来修复它,它不安全,但我在我的开发机器上承担了风险。
试试这个:
composer config -g -- disable-tls true
然后重新运行你的 Composer。对我有用!
但它不安全并且不推荐用于您的服务器。官网说:
If set to true all HTTPS URLs will be tried with HTTP instead and no network-level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini.
如果您不想在您的机器/服务器中启用不安全层,那么设置您的 php 以启用 openssl,它也可以工作。确保已安装 PHP Openssl 扩展并在 php.ini 文件中启用它。
要启用 OpenSSL,请在您的 php.ini 文件中添加或查找并取消注释此行:
Linux/操作系统:
extension=php_openssl.so
window :
extension=php_openssl.dll
并在需要时重新加载您的 php-fpm/web-server!
更新:
从 PHP 7.4 开始,扩展名为 extension=openssl
(在 Windows 中已知)。
关于php - SSL/TLS 保护需要 openssl 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35249620/