Stopping in-built php server on Mac Mavericks - Livecode
Asked Answered
A

1

8

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

Ailbert answered 1/9, 2014 at 15:19 Comment(0)
R
33

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

Right answered 1/9, 2014 at 15:32 Comment(2)
Hi, thanks for the detailed answer - that's sorted it - great answerAilbert
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.Aspirant

© 2022 - 2024 — McMap. All rights reserved.