Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping in-built php server on Mac Mavericks - Livecode

I'm developing something in Livecode and I have been experimenting with using Mavericks own in-built php server. I started the server by sending the following command through shell...

php -S localhost:8000

This enabled PHP to run successfully through localhost:8000/

However, I can not work out how to stop/disable PHP now in order to continue testing starting it - when I previously started PHP through the terminal I was able to do ctrl+c to stop php running but since I do not yet know how to do this through my app I get this error instead...

Failed to listen on localhost:8000 (reason: Address already in use)

Anybody know how I can stop it either via the terminal or through my Livecode app? Attempts to stop it through the terminal using just ctrl+c do not work

like image 861
user2317093 Avatar asked Sep 01 '14 15:09

user2317093


People also ask

How do I close a PHP server?

Press the (X) button on the top right(on Windows/Linux)/Press the red color circle on the top left(on Mac OS) of the terminal window to stop the PHP server from running. To verify, reload the server page and you will find a server not reachable page in place of your server page.

Is PHP pre installed on Mac?

Installation on macOS ¶PHP is bundled with macOS since macOS X (10.0. 0) prior to macOS Monterey (12.0. 0). Compiling is similar to the Unix installation guide.


1 Answers

open a terminal and type:

ps -ef | grep php

it will list the php process with the pid (process id)

something like

$ ps -ef | grep php

  501 14263 14133   0 10:25AM ttys001    0:00.21 php -S localhost:8000

  501 14355 14265   0 10:25AM ttys002    0:00.00 grep php

The note the number for the line that lists your php process, the second column is your pid in the example the process id us 14263, kill it:

$ kill 14263

do another ps

$ ps -ef | grep php

  501 14358 14265   0 10:26AM ttys002    0:00.00 grep php

$

The process should not be listed anymore

like image 111
CrankyTechGeek Avatar answered Nov 04 '22 15:11

CrankyTechGeek