我开始学习有关 Symfony 3 的教程,但在使用此命令创建新项目时遇到问题:
php symfony.phar new Symfony
我有这个错误:
[GuzzleHttp\Exception\RequestException]
Error creating resource: [message] fopen(): Unable to find the wrapper "https" - did you forget to enable it when y
ou configured PHP?
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 406
[message] fopen(https://get.symfony.com/symfony.version): failed to open stream: Invalid argument
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 406
[message] Undefined variable: http_response_header
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 407
[GuzzleHttp\Ring\Exception\RingException]
Error creating resource: [message] fopen(): Unable to find the wrapper "https" - did you forget to enable it when y
ou configured PHP?
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 406
[message] fopen(https://get.symfony.com/symfony.version): failed to open stream: Invalid argument
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 406
[message] Undefined variable: http_response_header
[file] phar://C:/xampp/htdocs/symfony.phar/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php
[line] 407
我本地安装了 PHP7,这可能是问题的根源吗?
提前致谢
最佳答案
可能根据 @0x13a 的评论,您没有安装 openssl。
我认为在 XAMPP 中这些是说明:
进入您的C:\xampp\php\ext\php.ini
文件并取消注释:
;extension=php_openssl.dll
如果没有,请尝试添加它。我相信 XAMPP 应该安装 openssl,但如果没有,您可能需要研究一下。
编辑 #2 - 对于 Marine1
使用此命令安装 openssl:
sudo apt-get install openssl
然后通过命令行 vi php 找出正在使用哪个 php.ini:
php -i |grep 'Loaded Configuration File'
然后用vi编辑上面指定的php.ini(下面是一个例子):
vi /etc/php.ini
并进行我指示的更改。
关于php - Symfony 3新建项目报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38945880/