Symfony 3 新项目错误 [英] Symfony 3 new project error
问题描述
我开始编写有关 Symfony 3 的教程,但在使用此命令创建新项目时遇到问题:
I start a tutorial about Symfony 3 and I'm facing an issue when creating a new project with this command :
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,这可能是问题的根源吗?
I have PHP7 installed locally, is it possible it's the source of the problem ?
提前致谢
推荐答案
可能根据 @0x13a 的评论,您没有安装 openssl.
Probably as per @0x13a 's comments you don't have openssl installed.
我认为在 XAMPP 中这些是说明:
I think in XAMPP these are the instructions:
进入你的 C:\xampp\php\ext\php.ini
文件并取消注释:
Go into your C:\xampp\php\ext\php.ini
file and uncomment:
;extension=php_openssl.dll
;extension=php_openssl.dll
如果没有,请尝试添加它.我相信 XAMPP 应该安装了 openssl,但如果没有,您可能需要研究一下.
If not, try adding it. I believe XAMPP should have openssl installed, but if not, you might need to look into that.
编辑 #2 - 对于 Marine1
Edit #2 - For Marine1
使用这个命令安装openssl:
Use this command to install openssl:
sudo apt-get install openssl
然后从命令行找出vi php正在使用哪个php.ini:
Then find out which php.ini is being used vi php from command line:
php -i |grep 'Loaded Configuration File'
然后用vi编辑上面指定的php.ini(下面是一个例子):
Then edit the above specified php.ini with vi (below is an example):
vi /etc/php.ini
并进行我指出的更改.
这篇关于Symfony 3 新项目错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!