Symfony 3新项目错误

时间:2016-08-14 19:36:42

标签: php symfony

我启动了一个关于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,它是否可能是问题的根源?

提前致谢

1 个答案:

答案 0 :(得分:3)

根据@ 0x13a的评论,你可能没有安装openssl。

我认为在XAMPP中这些是指示:

进入您的C:\xampp\php\ext\php.ini文件并取消注释:

  

;延长= php_openssl.dll

如果没有,请尝试添加它。我相信XAMPP应该安装openssl,但如果没有,你可能需要调查它。

编辑#2 - 对于Marine1

使用此命令安装openssl:

sudo apt-get install openssl

然后从命令行找出哪个php.ini正在使用vi php:

php -i |grep 'Loaded Configuration File'

然后用vi编辑上面指定的php.ini(下面是一个例子):

vi /etc/php.ini

并做出我指示的更改。