Xdebug Log Error : Could not connect to client

I: Connecting to configured address/port: localhost:9000.
E: Could not connect to client. :-(

You are getting this error because “LISTEN UP” : xdebug expects the client to open port 9000 so it can communicate with it. So it it the other way around (SMH)…
You probably expected the server to have port 9000 open don’t ya. Nops!!! The client is the one that needs to have port 9000 opened.

So if you are using Netbeans as an example and you are using a remote server for your PHP files, you need to follow these steps :

First  : 
Open up port 9000 on your client machine (Windows or Linux Firewall)

Second :  
Make sure you can telnet your client on port 9000 or whichever
port you choose FROM THE SERVER.

third : 
Configure the server to talk to the client. Lets say your client 
IP is 192.168.1.12. Change the Xdebug settings to the followings:

zend_extension=xdebug.so
xdebug.idekey=netbeans
xdebug.auto_trace = 1
xdebug.remote_handler=dbgp
xdebug.remote_host=192.168.1.12  ; This is the client IP
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_port=9000
xdebug.remote_log=/var/log/xdebug.log

Fourth: 
Configure your netbeans so the server can communicate with it:

xdebug-netbeans-settings

Fifth: Test it. Happy debugging!!!