7

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

user2317093
  • 746
  • 4
  • 8
  • 25

1 Answers1

32

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

Mark
  • 2,380
  • 11
  • 29
  • 49
CrankyTechGeek
  • 450
  • 9
  • 9
  • 1
    Hi, thanks for the detailed answer - that's sorted it - great answer – user2317093 Sep 01 '14 at 15:44
  • Today i had the same issue but couldn't kill the process. The process still appeared in the list. By adding "-9", I successfully killed the process: `$ kill -9 14263`. –  Nov 14 '17 at 13:29