简体   繁体   English

如何为 php 8.1.8 启用 PHP openssl 扩展

[英]how to enable PHP openssl extension for php 8.1.8

I am trying to install a package into my symfony 6.1 application, and when i run the command composer require sensio/framework-extra-bundle我正在尝试将 package 安装到我的 symfony 6.1 应用程序中,当我运行命令composer require sensio/framework-extra-bundle

I get this error message 
[RuntimeException] You must enable the openssl extension in your php.ini
to load information from https://... 

I tried to enable the openssl extension at the php.ini file but i cant find the (extension=php_openssl.dll) line, i only find this (extension=openssl) and it's alredy uncommented.我试图在 php.ini 文件中启用 openssl 扩展,但我找不到 (extension=php_openssl.dll) 行,我只找到这个 (extension=openssl) 并且它已经取消注释。


For the php version it's PHP 8.1.8对于 php 版本,它是 PHP 8.1.8

(ask me for any additionnal informations) (向我询问任何其他信息)


If someone could help me to find a solution and thank you very much for your time:)如果有人可以帮助我找到解决方案,非常感谢您抽出时间:)

On Windows (because of.dll)?在 Windows 上(因为.dll)?

try full path to the php ext folder instead of only extension=openssl (without extension)尝试 php ext 文件夹的完整路径,而不是仅 extension=openssl (无扩展名)

eg:例如:

extension=C:\Dev\php-8.1.8\ext\php_openssl扩展=C:\Dev\php-8.1.8\ext\php_openssl

Debug if openssl is loaded in PHP如果 PHP 中加载了 openssl 则进行调试

The symfony profile phpinfo, where you should be able to see, if your PHP configuration really runs openssl symfony 配置文件 phpinfo,您应该能够看到,如果您的 PHP 配置真的运行 openssl

try the following url尝试以下 url

http://{local server address, eg localhost:8001}/_profiler/phpinfo where you may change the beginning of the link to your environment http://{local server address, eg localhost:8001}/_profiler/phpinfo您可以将链接的开头更改为您的环境

outside symfony you may create an empty file eg phpinfo.php with the content在 symfony 之外,您可以使用内容创建一个空文件,例如phpinfo.php

<?php
phpinfo();

Fixing the issue解决问题

your post lacks of information on your environment.您的帖子缺少有关您的环境的信息。 How did you setup your developement environement.你是如何设置你的开发环境的。

As offtopic suggestion and to avoid this issue in the future you may have a look at docker, there you can setup a standardized environement, eg https://github.com/ger86/symfony-docker作为题外话的建议,为了将来避免这个问题,你可以看看 docker,在那里你可以设置一个标准化的环境,例如https://github.com/ger86/symfony-docker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM