Jervi
Back to all articles
laravelphp artisan serve

Laravel `php artisan serve` Fails on Windows (Ports 8000–8010) - Here is a quick fix

Failed to listen on 127.0.0.1:8000 Failed to listen on 127.0.0.1:8001

Laravel on Windows Be Like: “No Port for You” 😤

You install Laravel. You run:

bash
php artisan serve

Laravel replies:

text
Failed to listen on 127.0.0.1:8000
Failed to listen on 127.0.0.1:8001
...
Failed to listen on 127.0.0.1:8010

Every. Single. Port. ❌ Firewall? Fine. Project? Fresh.

If you’re on Windows (Herd / XAMPP / custom PHP), welcome to the club.


The Real Culprit 🕵️‍♂️

It’s just PHP config, especially for Windows

Some Windows PHP builds ship with this:

ini
variables_order = "EGPCS"

The Fix (30 seconds, no reinstalling)

1️⃣ Find your active php.ini

bash
php --ini

Example:

text
C:\Users\{username}\.config\herd\bin\php84\php.ini

2️⃣ Edit ONE line

Change this:

ini
variables_order = "EGPCS"

To this:

ini
variables_order = "GPCS"

3️⃣ Restart terminal & run again

bash
php artisan serve

Boom 💥

text
Starting Laravel development server: http://127.0.0.1:8000

Why This Works (TL;DR)

Laravel trusts $_SERVER more than $_ENV. Windows PHP said “nah”. You fixed the order. Peace restored 🧘‍♂️


Can’t edit php.ini?

Temporary hacks:

bash
php -S localhost:8000 -t public

or

bash
php artisan serve --host=localhost --port=8080

But let’s be real — fixing variables_order is the grown-up solution.