php - Symfony 3新建项目报错

标签 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,这可能是问题的根源吗?

提前致谢

最佳答案

可能根据 @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/

相关文章:

php - while 循环中信息重复

php - 保留 TextArea 中的换行符

templates - phpDocumentor 中的自定义模板(无法创建“phar :. ......)

symfony - 如何在 Symfony 2 及以上版本中调试 500 错误

mysql - 通过链式 ManyToOne 关系查找对象

php - 在我的网站中开发“点赞”按钮,而不是添加 Facebook“点赞”按钮

php - 使用 imagick 将 .psd 和 .ai 转换为 PNG/JPG

php - 项目外的 Laravel 文件系统

php - SQLSTATE[42000] : Syntax error or access violation: 1064 Symfony 2. 7.3 应用

html - 如何将按钮添加到导航栏?