Gru*_*ber 40 php netbeans xdebug
我希望使用不同计算机的团队能够在远程服务器上调试PHP ,但我很难让Xdebug在NetBeans 7.0.1中工作.我尝试过很多在线提示,但无济于事.
为了记录,我已在运行WampServer的Windows 7计算机上本地成功安装了Xdebug .所以我可以在NetBeans中使用断点调试PHP,前提是我将Project Properties-> Run Configuration-> Run As属性设置为Local Web Site.但是,如上所述,我的目标是在远程Web站点上的NetBeans中进行调试.
我的服务器是Ubuntu 11.04机器.我使用http://www.xdebug.org/find-binary.php的输出将适当的二进制文件放在机器上.我已经修改了php.ini
我能找到的所有文件(在php5/apache2
和php5/cli
目录中)以包含这些行:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
Run Code Online (Sandbox Code Playgroud)
如果我查看phpinfo.php
网页,它会说:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)
所以Xdebug似乎确实安装得很好.不过,当我在NetBeans中尝试调试时,我会收到无休止的状态栏消息Waiting For Connection(netbeans-xdebug).当我按下停止按钮时,我得到xdebug的X连接未在X秒内被检测到.原因可能是未安装或未正确配置xdebug.
也许我在这里混淆了服务器设置的本地设置?一个帖子说,xdebug.remote_host
应设置为运行的NetBeans的机器的IP,但我希望球队能够用机器用不同的IP地址进行调试.问题可能是端口9000,但我已检查它是否被阻止.
任何可以澄清这一点的帮助将不胜感激!
Lin*_*een 61
运行PHP(和XDebug)的服务器需要能够连接到您的工作站/桌面.
所以你需要通过告诉它连接到特定的 IP地址(xdebug.remote_host
)或自动"连接回"(xdebug.remote_connect_back
)来相应地设置服务器.但后者有一些安全隐患.这些在手册中列出.
Álv*_*lez 17
关键指令是这样的:
xdebug.remote_connect_back = On
Run Code Online (Sandbox Code Playgroud)
这允许Web服务器连接到要求调试会话的任何计算机.这样您就不必对IP地址进行硬编码并且能够共享Xdebug.此指令在早期版本中不存在,并且通常在教程和文档中省略.
您还需要验证每台客户端计算机是否接受到端口9000(xdebug.remote_port
)的传入连接.这包括配置防火墙并确保调试器客户端已启动并正在运行
小智 17
对我来说,xdebug.remote_connect_back = On
不起作用.我所做的是在我的客户端机器上设置ssh端口转发.
远程机器上的xdebug配置:
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
Run Code Online (Sandbox Code Playgroud)
客户端计算机上的转发端口:
ssh -g -N -lusername -R9000:127.0.0.1:9000 [remote.host.ip]
Run Code Online (Sandbox Code Playgroud)
必须允许远程计算机上的shell访问.
Bra*_*oss 12
摘要:https : //xdebug.org/docs/upgrade_guide
xdebug.
( remote_enable
| default_enable
| profiler_enable
| auto_trace
| coverage_enable
)xdebug.mode=debug
或使用develop
| coverage
| gcstats
|profile
xdebug.start_with_request=yes
xdebug.remote_autostart
被替换xdebug.mode=debug
用xdebug.start_with_request=yes
xdebug.remote_host
被替换为 xdebug.client_host
xdebug.remote_port
替换为xdebug.client_port
OR 在 IDE 设置中使用新的默认值(更多内容见下文)xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.idekey=myKey
xdebug.client_host=x.y.z.a
xdebug.remote_handler=dbgp
Run Code Online (Sandbox Code Playgroud)
在哪里
x.y.z.a
= 您的 IDE 主机myKey
= 您在 IDE 中配置的密钥remote_port
到9003
(Xdebug的新的默认端口)或设置xdebug.client_port
于9000
在配置上面保留旧默认就我而言,这些命令帮助了我:
xdebug.remote_enable = On
xdebug.remote_autostart=1
Run Code Online (Sandbox Code Playgroud)
注意:即使由于'xdebug.remote_autostart = 1'而不存在GET/POST/COOKIE变量,调试器仍然有效
我在尝试配置 docker 时遇到过几次同样的问题,在多次挠头之后我意识到这是解决它的方法。所以我决定把它放在这里作为我未来的自己的答案。
大多数情况下,Dockerfile 会将此语句添加到 php.ini 中:
xdebug.remote_connect_back = on
Run Code Online (Sandbox Code Playgroud)
这会导致一切看起来都很好,但不知何故,PHP 风暴实际上没有捕获任何调试连接。用以下内容替换上面的行立即为我解决了问题。
xdebug.remote_connect_back = 0
xdebug.remote_host = host.docker.internal
Run Code Online (Sandbox Code Playgroud)
当然,在那之后你仍然需要运行:
$ docker-compose down
$ docker-compose build
和
$ docker-compose up -d
注意:在 Linux 上是host.docker.internal
行不通的。你可以172.17.0.1
改用。(注意不是 127.0.0.1,我一直以为是因为我有点不听话)
归档时间: |
|
查看次数: |
52417 次 |
最近记录: |