Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

biniyam20's avatar

Why is php artisan serve not working anymore?

I am new to laravel development and have been migrating my web app to laravel for the past two weeks but suddenly my local server has stopped responding.

localhost:8000 does not load any page, previously it loaded my app's home page. Now, it looks like it is in an infinite request loop or something as indicated by the rotating circle on the top of the tab.

I've tried the following solutions but still no luck:

php -S localhost:8000 -t public/

as referred here https://stackoverflow.com/questions/41331631/why-command-php-artisan-serve-not-working

I have also tried other ports but I cannot successfully make a request to the server on those ports either

php artisan serve --port=8888

I have also run the code below to see which ports are active and kill those ports but I still do not receive a response after restarting the server.

 ps -ef | grep php
 sudo kill some number

I think my issue is something deeper than switching the ports up because regardless of the port, I still do not get a server response. Interestingly enough, if I whip up MAMP I do get a response from that server which is on a different port.

Can anyone advice me on getting a working server up that I can continue to use for my local development? I would prefer to not switch all of my development to a MAMP server, considering it is mainstream to develop using php artisan serve.

0 likes
6 replies
skoobi's avatar

Are the routes correct and the code correct on the app, or is it a new install.

biniyam20's avatar

Hi skoobi, thanks for the quick response. Can you clarify what you mean by are the routes and the code correct on the app? I will try and answer as best as possible.

I downloaded Laravel two weeks ago. Everything was working fine, including the routes, up until a few hours. For example, I could reach the "/" route and it would direct me to the correct view. Now I don't get routed at all.

My assumption is even if there was an error in the routes file Laravel would through me the error with a "method not found exception" or "controller not found" but I don't receive any response at all. My impression is that my request is not even hitting the routes file. I am just starting at a white page.

Cronix's avatar

do the error logs provide any info? /storage/logs/laravel.log

biniyam20's avatar

The most recent error is

[2018-11-10 19:35:56] local.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `listings` where `availability` = Y order by `upload_date` desc limit 10) {"exception":"[object] (Illuminate\Database\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `listings` where `availability` = Y order by `upload_date` desc limit 10) at /Users/Biniyam/code/NextDorm/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /Users/Biniyam/code/NextDorm/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70)

I do not think this SQL error was causing my issue.

However, the server is working now! I restarted my computer a few hours ago and recently re-killed all of the processes on the ports, and restarted the server and now it works. This is very odd behavior. Not sure what to make of it. I hope it doesn't happen again.

biniyam20's avatar

Right before it stop worked I was toying around with Laravel Dusk and making sure dusk was using the right port for connecting to my app.

arthvrian's avatar

Maybe you 'kill' MySQL too

it seems that your MySQL server is down or running on another port

Please or to participate in this conversation.