Endogen
Endogen

Reputation: 651

How to shutdown default PHP server "php -S"

I can start the default PHP server with php -S localhost:8000 but how to stop the server? Usually with CTRL + C yes, but if i want to do it from another terminal?

Upvotes: 1

Views: 4207

Answers (3)

Daniel Kudrin
Daniel Kudrin

Reputation: 11

Open terminal, run htop. Press / to search and type in php -S or localhost or whatever command you've entered, F3 to search for next references if needed. Press F9 to kill the process.

Upvotes: 1

Daniel Alder
Daniel Alder

Reputation: 5382

starting:

nohup php -S localhost:8000 &
pid=$!
echo $pid >/var/run/php.pid

stopping

pid=$(cat /var/run/php.pid)
kill $pid

That's only an example without proper error handling

Upvotes: 1

Nenad Mitic
Nenad Mitic

Reputation: 567

Find the process ID, and issue a kill command. On Ubuntu linux, you can use "top" command line utility to see and stop running processes.

Once you start top, use "L" to search for "php", and you'll se it's process id

Upvotes: 0

Related Questions