Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XDebug could not connect to client

I am trying to debug with NetBeans Mac locally.

This is my php.ini

[xdebug]
 xdebug.default_enable=1
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
 xdebug.remote_host=localhost
 xdebug.remote_port=9000
 xdebug.remote_autostart=1
 xdebug.remote_log="/Applications/MAMP/logs/xdebug.log"
 xdebug.idekey="netbeans-xdebug"
 zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"

This is what I had been getting in xdebug.log

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

I try changing the port to 9001 and turn off firewall and it didn't help.

like image 944
user1688346 Avatar asked Jun 10 '13 22:06

user1688346


People also ask

How do I enable Xdebug log?

Enable Xdebug logging by adding the following line into php. ini: xdebug. remote_log=/log_path/xdebug.

What port does Xdebug use?

By default, Xdebug 2 listens on port 9000. For Xdebug 3, the default port has changed from 9000 to 9003. You can specify several ports by separating them with a comma. By default, the Debug port value is set to 9001,9003 to have PhpStorm listen on both ports simultaneously.


1 Answers

Xdebug's default port (9000) conflicts with FastCGI (Xdebug was first!) - the solution is to change it to another port. After having done that, you need to restart your IDE where you will also need to configure the new port. You will also need to restart PHP and your Web Server.

like image 149
Derick Avatar answered Oct 30 '22 13:10

Derick