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

I am deploying my Symfony 4 app to the production environment for the first time using rsync.

I then try to run the doctrine:migrations:migrate command.

php -v : PHP 5.6.40

CentOS: 7.6

EasyApache4

When I execute:

bin/console doctrine:migrations:migrate

I received the following error:

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

I understand that Symfony 4 DoctrineMigrationsBundle requires PHP 7.1 so I also tried the following:

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

And I received the following error:

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"} []

Thank you in advance

1 answer

  • answered 2019-02-10 12:45 FAEWZX

    Setup PATH to php bin folder

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