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 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思