Saturday, 26 December 2015

Error shooting - PHP Warning: socket_bind(): unable to bind address [98]: Address already in use

problem:
-------------------------------------------------------------------------------------------------------------------

The problem occurs when you try to run you file(I am running a php client listen file) on server side,
this issue keep returning even after killing the process

PHP Warning:  socket_bind(): unable to bind address [98]: Address already in use 

for example: after running
# TOP
in server, find the process you want to stop, then
# kill $PID
then check the process, it was gone, in ideal situation. Okay, you won't found this process now, but when you try to run this file in you server, the error still exist.

So here is the solution:
--------------------------------------------------------------------------------------------------------------------

That error means there's something already listening on that port you're trying to listen on.
To find the culprit, use:
# netstat -tulpn
Then, after you made very sure you want to kill it, kill it, with either
# kill $PID
or, if that doesn't work, use the crowbar:
# kill -9 $PID


(replace $PID with the process id you want to kill)
#TIP: this is really useful to use netstat cammanf line to check current processes instead of top command line#

No comments:

Post a Comment