Amirhossein256's avatar

Laravel 13 artisan commands close when interactive prompts are required on Windows (PHP 8.4/8.5)

Hello everyone,

I am having a strange issue with Laravel 13 on Windows.

Whenever an Artisan command requires user interaction (a prompt/question), the terminal process exits immediately after showing the question.

For example:

php artisan migrate

Output:

WARN The database 'faraertebat-db' does not exist on the 'mysql' connection.

Would you like to create it? (yes/no) [yes] ❯

At this point, the terminal immediately closes/returns to the prompt. I cannot type yes or no.

This happens with any interactive Artisan command, not only migrations.

Environment OS: Windows 11 Laravel: 13.x PHP CLI: PHP 8.4.22 (cli) ZTS Visual C++ 2022 x64 Composer: Composer version 2.10.1 Terminal: PowerShell CMD other terminals

I tested multiple terminals and the behavior is the same.

Things I already tested

  1. STDIN works correctly

This works:

php -r "echo fgets(STDIN);"

I can type input and it is received.

  1. Tinker starts normally php artisan tinker

opens correctly.

However, inside Tinker I get this:

Psy Shell v0.12.23 (PHP 8.4.22)

PARSE ERROR PHP Parse error: Syntax error, unexpected T_STRING in vendor\psy\psysh\src\Exception\ParseErrorException.php 3. Tried PHP 8.5

I also tested with PHP 8.5:

C:\wamp64\bin\php\php8.5.7\php.exe artisan migrate

The same behavior happens:

Would you like to create it? (yes/no) [yes] ❯

then the process exits.

  1. Composer update

I ran:

composer update

No change.

  1. Tried disabling prompts

I tried adding:

LARAVEL_PROMPTS_NO_INTERACTION=true

and also:

Prompt::fallbackWhen(true);

in AppServiceProvider, but the issue remains.

Older Laravel projects on the same machine work fine. The issue only appears with newer Laravel versions using the new interactive prompt system.

It looks like something related to:

Laravel Prompts Symfony Console QuestionHelper PHP 8.4/8.5 compatibility Windows CLI input handling

Has anyone experienced this or knows the correct workaround?

0 likes
0 replies

Please or to participate in this conversation.