'Laravel failed to listen on 127.0.0.1:8000 (reason ?)

enter image description here

So I just created a new project using the command:

laravel new blog

Then I started by changing the directory and do the command

php artisan serve

And this is what happened, more details:

  1. I'm using laravel 8.0.1 (latest version)
  2. I haven't run any command except the one I listed above
  3. I'm using windows
  4. I even updated the php to 7.4.10 (latest ver)


Solution 1:[1]

So actually i dont actually know what the reason is, but using the php -S localhost:8000 -t public

Solution 2:[2]

I came across the same issue. This was how how I solved mine:

  1. Goto the main PHP part, I mean the installed PHP from official website.
  2. Look out for a folder named php.ini-development
  3. Duplicate this file.
  4. Then rename the copy to php.ini
  5. Go back to your laravel project folder and rerun php artisan serve

PS: If there is any additional steps you took, you can as well comment them below: XOXO

Solution 3:[3]

Check your PHP version in your local server and System variable path. Make sure they are using the same PHP version

Solution 4:[4]

I had this problem too, and I solved it in this way:

set: php.ini

variables_order = "GPCS"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mario Gunawan
Solution 2 Fritzdultimate
Solution 3 Azizjon Nigmatov
Solution 4 karel