XDebug could not connect to client

情到浓时终转凉″ 提交于 2019-12-21 03:32:08

问题


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.


回答1:


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.




回答2:


Step 1: Change xdebug.remote_port=9000 to xdebug.remote_port=9001

Step 2:

  1. Change the debugging port in Netbeans. Go to Tools >> Options >> Click PHP tab
  2. Under PHP tab click debugging
  3. Change the debugger port : 9001
  4. Change Session ID : netbeans-xdebug

Step 3: Restart server and netbeans

Step 4: Set a breakpoint and try




回答3:


I had exact the same problem. The xdebug installion wizard (https://xdebug.org/wizard.php) showed that my xdebug was correctly installed. (The wizard told me to install the Xdebug 2.5.0rc1 dll) In phpinfo I also got a xdebug section showing (in my opinion) the correct values. Even with this I got a "could not connect to client" message in the error log.

Eventually I solved it by trial and error doing the following: Downloaded all the older versions of the xdebug dll's for my php version and tried them all. Eventually one of them worked. For me it was with php 5.6.8 the xdebug 2.4.1 dll (PHP 5.6 VC11 TS (32 bit) ) on a windows 7 32 bit machine. I am using xampp-win32-5.6.8-0-VC11.zip for my xampp installation.

What I learned was the following: (a) The Xdebug wizard does not neccesarily give the correct dll to use (b) Even though phpinfo shows a Xdebug section with correct variables this does not necessarily mean that it is correct. (c) Try older versions of the dll's if you get this error.



来源:https://stackoverflow.com/questions/17033605/xdebug-could-not-connect-to-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!