02 Aug 2020
PHP 基本

當使用 PHP CLI 啟動 Built-in web server 內置伺服器時

php -S 127.0.0.1:8401

Untitled

如果不小心離開終端,無法使用 Ctrl-C 關閉

使用 Linux 的 lsof 指令,查詢系統上各行程所開啟的檔案

https://blog.gtwang.org/linux/linux-lsof-command-list-open-files-tutorial-examples/

sudo lsof -i :8401

使用靜態的 ps 查詢程序

-u :有效使用者 (effective user) 相關的 process

ps u 2935

Untitled

刪除程序

sudo kill -KILL 2935

Untitled

Untitled

成功關閉 Built-in web server 內置伺服器

Untitled

參考

https://stackoverflow.com/questions/34563972/osx-failed-to-listen-on-localhost80-reason-permission-denied


回上一頁