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#

Monday, 14 December 2015

laravel5 php artisan migrate error


Problem:
----------------------------------------------------------------------------------------------------------------------
[PDOException] occurs when i try to running php artisan migrate in laravel5

looks like here:
MacBook-Pro:laravel5-project user$ php artisan migrate:refresh --seed


                                                    
  [PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory  

Solution:
-----------------------------------------------------------------------------------------------------------------------
change host name in .env file
from:
DB_HOST=local host
to:
DB_HOST=127.0.0.1

It should be success when you try to run php artisan migrate again.