Symfony - 无法使用安装程序创建新项目

Symfony - Unable to create new project using installer

我正在尝试学习 Symfony,但到目前为止,除了我的应用程序的实际开发之外,我一直在安装和做其他事情。

我尝试使用安装程序在我的 Windows 机器上创建一个新的 Symfony 项目。我完全按照说明进行操作 in the book。我可以成功下载 symfony.phar 但是当我 运行:

php symfony.phar

我收到以下错误:

PHP Warning:  Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9
PHP Stack trace:
PHP   1. {main}() symfony.phar:0
PHP   2. Phar::mapPhar() symfony.phar:9

Warning: Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9

Call Stack:
    0.0017     227224   1. {main}() symfony.phar:0
    0.0017     227920   2. Phar::mapPhar() symfony.phar:9

PHP Fatal error:  Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar:9
Stack trace:
#0 symfony.phar(9): Phar::mapPhar('default.phar')
#1 {main}
  thrown in symfony.phar on line 9

Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar on line 9

PharException: unable to open phar for reading "symfony.phar" in symfony.phar on line 9

Call Stack:
    0.0017     227224   1. {main}() symfony.phar:0
    0.0017     227920   2. Phar::mapPhar() symfony.phar:9

我找不到任何对此有帮助的东西。

原因似乎是在我的 Windows 命令提示符中我位于 C:\Users\Me\My Documents 的子目录中。 symfony.phar 和 Composer 都不能在这个目录下工作。它必须来自 C:\Users\Me\Documents 这是实际的物理位置,而不是 My Documents 这只是一个虚拟目录。

我不知道它为什么不起作用的确切技术细节。