dongshi3818 2016-07-28 13:59
浏览 114
已采纳

IntelliJ PHP调试器无法连接

I've set up php 5.6 and Apache on my Mac and have IntelliJ with the php plugin installed (2016.2). The problem is that the IDE doesn't want to connect to the local server.

I've added the following lines to my php.ini:

[xdebug]
zend_extension=/usr/local/Cellar/php56/5.6.24/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_port = "9000"

and when I run php -v I get:

Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

and phpinfo() shows

xdebug.remote_enable On On
xdebug.remote_port 9000 9000

But IntelliJ shows:

xdebug.remote_enable 0

I've checked, that I'm pointing to the right php.ini (checked path and other changes appear when the file is edited).

I tried all configurations (including with an IDE key) but nothing seems to work.

Is there a way I can check if the debugging is really working (i.e. is it the IDE not recognizing something or is the server faulty), because at this point I don't know what the problem may be.

  • 写回答

1条回答 默认 最新

  • dsf4s5787 2016-07-28 19:00
    关注

    The best way is to collect xdebug log for such unsuccessful debug session to see what it has to say. Sometimes debug does not work for you (IDE shows no reaction) but xdebug actually connects somewhere just fine (e.g. another service .. as described below).

    There is a chance that you will have php-fpm running on your computer (that depends on how you installed your PHP -- what tool you have used for that). Php-fpm by default uses the same TCP 9000 port as xdebug does.

    sudo lsof -nP -iTCP -sTCP:LISTEN
    

    Run this command in terminal -- it should tell (after filtering results on 9000 keyword) what services are already listening on that port.

    If it's indeed php-fpm .. then changing xdebug port from default 9000 to any other (e.g. 9001 or any other usually unused port) in both IDE settings + php.ini will solve the issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器