When I started the server while learning PHP ... Since it came out as follows, I will summarize the remedy It may be difficult to write and read for the first time, but I hope it helps someone.
[vagrant@localhost]$ php -S 192.168.33.10:8000
Failed to listen on 192.168.33.10:8000 (reason: Address already in use)
I closed the putty terminal to turn off the PHP server, The server is in use and has an error at startup
Even after solving it, if you do this, it will be quite troublesome to type commands, so We strongly recommend that you turn off the server before closing it.
#Log in as root user to check the process
//If you have trouble logging in as root, please add sudo when you type the command.
[vagrant@localhost ~]$ ps -a
#If you know the port, check below
[vagrant@localhost ~]$ lsof -i:8000
#If you can't lsof, install below
[vagrant@localhost ~]$ yum -y install lsof
#When you type the above command, the running server information including PID will be displayed as shown below.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
php 10721 vagrant 3u IPv4 20710 0t0 TCP 192.168.33.10:irdmi (LISTEN)
#kill (PID number)Enter to end the process
[vagrant@localhost ~]$ kill 10721
#It will start when you type the command again
[vagrant@localhost ~]$ php -S 192.168.33.10:8000
PHP 5.6.40 Development Server started at Mon Jan 6 12:21:24 2020 Listening on http://192.168.33.10:8000
#If killing does not help, kill-9 (PID number)Please forcibly terminate with
[vagrant@localhost ~]$ kill -9 10721
This time I wrote about the kill </ font> command, but if you want to know more Click on the kill letter for more information If you have any suggestions, I would appreciate it if you could comment! !! Thank you for reading to the end
Recommended Posts