无法执行 bin/console doctrine:migrations:migrate RuntimeException /vendor/symfony/console/Helper/QuestionHelper.php:129

Cannot execute bin/console doctrine:migrations:migrate RuntimeException /vendor/symfony/console/Helper/QuestionHelper.php:129

我是第一次使用 rsync 将我的 Symfony 4 应用程序部署到生产环境。

然后我尝试 运行 doctrine:migrations:migrate 命令。

php -v : PHP 5.6.40

中央操作系统:7.6

EasyApache4

当我执行时:

bin/console doctrine:migrations:migrate

我收到以下错误:

Fatal error: Default value for parameters with a class type hint can only be NULL in /home/simpleit/ch.simpleitsolutions.bookings/vendor/symfony/console/Application.php on line 85

我知道 Symfony 4 DoctrineMigrationsBundle 需要 PHP 7.1,所以我也尝试了以下操作:

/usr/bin/ea-php71 bin/console doctrine:migrations:migrate

我收到以下错误:

WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)[2019-02-10 12:10:52] console.ERROR: Error thrown while running command "{command}". Message: "{message}" {"exception":"[object] (Symfony\Component\Console\Exception\RuntimeException(code: 0): Aborted at /home/<account_dir>/vendor/symfony/console/Helper/QuestionHelper.php:129)","command":"doctrine:migrations:migrate","message":"Aborted"} []

提前致谢

将 PATH 设置为 php bin 文件夹

env PATH="/opt/cpanel/ea-php71/root/usr/bin:$PATH" bin/console doctrine:migrations:migrate
bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration