laravelwindowstty

TTY mode is not supported on Laravel using windows


While trying to use the command "php artisan db" to run sql commands on the VScode terminal, I got this message saying that TTY mode is not supported on Windows platform.

I read similar questions asked about this issue but couldn't find an accurate response/solution to get rid of the error or being able to disable the impediment without switching to Linux or...

I'm using Laravel 11.x


Solution

  • Windows does not natively support TTY mode. TTY mode provides an interactive command-line interface.

    Why need TTY for php artisan db?

    The TTY ensures that user inputs passed in the command are interactively forwarded to the appropriate database engine, without the need for the database server to be present. This essentially provides a built-in server for Laravel users, but the technology offered by TTY is indispensable for this functionality.

    What can you do if you still want to use it?

    Since Windows does not support TTY mode, you need to find an alternative.

    powershell tty

    How can I check if I have TTY support?

    It's simple. Run the tty command in your terminal.

    Git Bash

    Git Bash supports TTY mode; give it a try. Git Bash provides a Unix-like environment on Windows, which is how it makes TTY available.

    git bash tty

    Windows Subsystem for Linux (WSL)

    WSL allows you to run a Linux environment within Windows without needing a separate OS installation. This means you can install a Linux distribution under Windows and manage it from the Windows command line. You can install PHP on WSL and run your Laravel project from there.

    wsl tty