问题
I just installed composer, php, apache etc. on my new SSD. After that I wanted to start coding. I opened my project from another drive in IDE. Then I wanted to load my fixtures into my new database, but I cannot. I cannot even make migrations etc. The php bin/console is broken (It automatically aborts any terminal input etc). I tried to run commands from other terminals, but it doesn't work. You can see commands below w/ or without -vvv. Thanks for any reply how to fix it.
First:
D:\project>php bin/console doctrine:fixtures:load
Careful, database "project1" will be purged. Do you want to continue? (yes/no) [no]: >
Aborted.
doctrine:fixtures:load [--append] [--group GROUP] [--em EM] [--shard SHARD] [--purge-with-truncate] [-h|--help] [-q|--quiet] [ -v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]
One more:
D:\project>php bin/console make:controller
Choose a name for your controller class (e.g. VictoriousGnomeController): >
Aborted.
make:controller [--no-template] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-in teraction] [-e|--env ENV] [--no-debug] [--] []
With verbose
D:\project>php bin/console -vvv make:controller
2019-12-10T12:48:26+00:00 [debug] Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\Deb ugHandlersListener::configure".
Choose a name for your controller class (e.g. AgreeableJellybeanController):
2019-12-10T12:48:26+00:00 [error] Error thrown while running command "-vvv make:controller". Message: "Aborted." 2019-12-10T12:48:26+00:00 [debug] Notified event "console.error" to listener "Symfony\Bundle\MakerBundle\Event\ConsoleErrorSub scriber::onConsoleError". 2019-12-10T12:48:26+00:00 [debug] Notified event "console.error" to listener "Symfony\Component\Console\EventListener\ErrorLis tener::onConsoleError". 2019-12-10T12:48:26+00:00 [debug] Command "-vvv make:controller" exited with code "1" 2019-12-10T12:48:26+00:00 [debug] Notified event "console.terminate" to listener "Symfony\Bundle\MakerBundle\Event\ConsoleErro rSubscriber::onConsoleTerminate". 2019-12-10T12:48:26+00:00 [debug] Notified event "console.terminate" to listener "Symfony\Component\Console\EventListener\Erro rListener::onConsoleTerminate".
In QuestionHelper.php line 137:
[Symfony\Component\Console\Exception\RuntimeException]
Aborted.Exception trace: at D:\apache\www\itnetwork\vendor\symfony\console\Helper\QuestionHelper.php:137 Symfony\Component\Console\Helper\QuestionHelper->doAsk() at D:\apache\www\itnetwork\vendor\symfony\console\Helper\QuestionHel per.php:85 Symfony\Component\Console\Helper\QuestionHelper->Symfony\Component\Console\Helper{closure}() at D:\apache\www\itnetwork\vend or\symfony\console\Helper\QuestionHelper.php:437 Symfony\Component\Console\Helper\QuestionHelper->validateAttempts() at D:\apache\www\itnetwork\vendor\symfony\console\Helper\ QuestionHelper.php:88 Symfony\Component\Console\Helper\QuestionHelper->ask() at D:\apache\www\itnetwork\vendor\symfony\console\Style\SymfonyStyle.p hp:360 Symfony\Component\Console\Style\SymfonyStyle->askQuestion() at D:\apache\www\itnetwork\vendor\symfony\console\Style\SymfonySt yle.php:267 Symfony\Component\Console\Style\SymfonyStyle->ask() at D:\apache\www\itnetwork\vendor\symfony\maker-bundle\src\Command\MakerC ommand.php:95 Symfony\Bundle\MakerBundle\Command\MakerCommand->interact() at D:\apache\www\itnetwork\vendor\symfony\console\Command\Command .php:240 Symfony\Component\Console\Command\Command->run() at D:\apache\www\itnetwork\vendor\symfony\console\Application.php:1029 Symfony\Component\Console\Application->doRunCommand() at D:\apache\www\itnetwork\vendor\symfony\framework-bundle\Console\Appl ication.php:86 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at D:\apache\www\itnetwork\vendor\symfony\console\Applicat ion.php:272 Symfony\Component\Console\Application->doRun() at D:\apache\www\itnetwork\vendor\symfony\framework-bundle\Console\Application .php:74 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at D:\apache\www\itnetwork\vendor\symfony\console\Application.php :148 Symfony\Component\Console\Application->run() at D:\apache\www\itnetwork\bin\console:39
make:controller [--no-template] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-in teraction] [-e|--env ENV] [--no-debug] [--] []
回答1:
seems like this issue comes from a bug whitin the php 7.4 release on windows only
- https://bugs.php.net/bug.php?id=78883
- https://github.com/php/php-src/pull/4961
Other links:
- https://github.com/symfony/symfony/issues/34702
- https://github.com/symfony/symfony/issues/34754
- https://github.com/phpMussel/phpMussel/issues/211
- https://github.com/php/php-src/pull/4952
回答2:
PHP version 7.4 has a bug in the "interactive cmd" with windows 10!
You can download and use PHP 7.3 instead and the problem is gone.
来源:https://stackoverflow.com/questions/59267313/symfony-v4-php-bin-console-doesnt-work-as-expected-automatically-aborted