我如何安装 Symfony 4 而不是 Symfony 3.4?

How can I install Symfony 4 instead of Symfony 3.4?

我尝试安装 Symfony 4 as per the documentation 但一直以 3.4 版本结束。

如何安装正确的版本?

$ sudo apt update && sudo apt upgrade -y
$ php -v | head -n1
PHP 7.0.27-0+deb9u1 (cli) (built: Jan  5 2018 13:51:52) ( NTS )

$ composer clearcache
$ composer self-update
You are already using composer version 1.6.4 (stable channel).

$ composer create-project symfony/website-skeleton my_project
$ cd my_project && bin/console about | head -n4
 -------------------- ---------------------------------------------------- 
  Symfony                                                                  
 -------------------- ---------------------------------------------------- 
  Version              3.4.9 

another question 中建议您需要 php 7.2,我该如何检查?目前的Debian版本好像是7.0.

Symfony 4.0 的 symfony/website-skeleton 包有一个 composer.json 声明了 "php": "^7.1.3".

的要求

https://github.com/symfony/website-skeleton/blob/4.0/composer.json

(Symfony 4.0 本身也是如此,顺便说一句:https://github.com/symfony/symfony/blob/v4.0.0/composer.json

您需要将 PHP 至少升级到该版本才能使用它。在那之前,Composer 将为您提供与您的 PHP 版本相匹配的最新版本的软件包。

Symfony docs 也说明了这一点。

Symfony 4.0 requires PHP 7.1.3 or higher to run, in addition to other minor requirements.