Skip to content
Advertisement

laravel server not responding to requests unless restarting the CLI but works fine in www folder

I’m running a Laravel app with php artisan serve. When I start it from the CLI, it works the first time fine. But when refreshing the URL, it stops responding and the link becomes pending in a loop in Chrome’s Inspect Network tab. Then when I close the CLI and reopen it again, it works fine again the first time, but still doesn’t work when restarting the server only.
But when I run the app from the www folder in WAMP it works fine.
So what’s the problem?
Is it with the env file?

Advertisement

Answer

If you are using the latest version for Laravel 5.X, you will see that sometimes the php artisan serve command doesn’t work properly. If you face this type of problem, you can use the below command and start your server locally.

So there is a different solution: you can use your php cli server command instead of the artisan command

php -S localhost:8000 -t public/

make sure that your PHP is in your global variables

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement