Stopping in-built php server on Mac Mavericks - Livecode

user2317093 picture user2317093 · Sep 1, 2014 · Viewed 14.3k times · Source

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

Answer

CrankyTechGeek picture CrankyTechGeek · Sep 1, 2014

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