'How can I stop a symfony process which is listening on http://127.0.0.1:8000

I am trying to run a basic Symfony installation which I generated using this command :

$ symfony new basic

When I run the following commands :

$ cd basic
$ php bin/console server:run

I get this error message :

[ERROR] A process is already listening on http://127.0.0.1:8000.

I suspect that a previous symfony process is causing this but I have no clue how to stop it.

I'm on a Ubuntu 14.04 machine. Any help would be appreciated.



Solution 1:[1]

You can stop the server using:

php bin/console server:stop

or you can force server to start even if previous one is running:

php bin/console server:start --force

For more info check the doc

Solution 2:[2]

Better to use killall -9 php to kill all php scripts that are running. Otherwise you wil start a new one while the previous one is still running.

Is probably caused by a infinite loop.

Note: This will "kill" all running php scripts

Solution 3:[3]

This works on Symfony 5. Open the integrated terminal inside VSCode.

First stop the running local server:

symfony local:server:stop

Then start a new one:

symfony server:start

Open your browser and navigate to: 127.0.0.1:8000

If the command symfony is not recognized, then you need to install the Symfony as instructed here: Install Symfony

Solution 4:[4]

First check what process is running on port 8000.

ps aux | grep 8000

You should something like:

username       94169   0.0  0.0  4427240    396 s018  S    18Jun19   6:43.42 /usr/local/Cellar/php56/5.6.33_9/bin/php -S 127.0.0.1:8000 /Users/myuser/app...

Get the PID and kill it.

kill -9 94169

Re run the ps aux command and make sure the process is no longer there. If it's still there you might need to run with sudo.

Your server:start should work after this.

Cheers!

Solution 5:[5]

Using ps aux | grep 8000 did not work for me, I think it's because I'm using the stand alone web server rather than the bundle.

As per @Twinfriends comment, the following worked for me:

In terminal:
lsof -wni tcp:8000
This will show you the PID, which you use to do:
kill -9 PID
Replacing "PID" with your PID number

Solution 6:[6]

What worked for me was this (idk why but im posting it in case it might help someone

i simply restarted my xampp server and replayed the command and it worked.

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 Tomasz Madeyski
Solution 2 Sylvain Attoumani
Solution 3
Solution 4 alakin_11
Solution 5 James
Solution 6 Muhammad Mubashir