与许多人一样,我在调试 IDE 与 XDebug 的连接上所花费的时间比使用 XDebug 调试程序所花费的时间还要多。 我已经让它反复工作,但每隔一段时间我就会得到常见的 “Waiting to connect” problem .我无法定位导致 XDebug 工作或失败的原因。我已经使用 ubuntu 两年了;我既不是菜鸟也不是 strace 大师。 我做错了什么?如何更好地调试 IDE 与 XDebug 的连接?
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_log=/var/log/xdebug.log xdebug.extended_info=1 xdebug.idekey="netbeans-xdebug"
I can't explain what causes the problem or when the problem manifests. It begins when I try to debug my project, which causes my dev browser of choice (Chrome) to open to the url of my project with the parameter XDEBUG_SESSION_START=netbeans-xdebug. This causes the page to render normally in chrome while Netbeans reports only “Waiting to Connect.”
First, with the “Waiting to Connect” message still alive, I’ll try to use netstat to dig around port 9000, which goes something like this:
$ netstat -an | grep 9000
tcp6 0 0 :::9000 :::* LISTEN
我关闭了我的 IDE 并尝试使用两个文件来帮助弄清楚发生了什么:{webroot}/index.php包含 <?php phpinfo(); ?> , 和 {webroot}/dbgtest.php包含 XDebug installation check script :
<?php
$address = '127.0.0.1';
$port = 9000;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Unable to bind');
socket_listen($sock);
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);
?>
当我启动 XDebug debugclient并打开 http://127.0.0.1/dbgtest.php?XDEBUG_SESSION_START=mysession , 我通常会得到 regular output然后验证 XDebug 是否已在另一个终端中使用 netstat 连接到脚本:
$ netstat -an | grep 9000
tcp 0 0 127.0.0.1:9000 127.0.0.1:34831 ESTABLISHED
tcp 0 0 127.0.0.1:34831 127.0.0.1:9000 ESTABLISHED
虽然这两个似乎都表明已建立连接,但网页显示“无法绑定(bind)”,我无法解释。我 Ctrl-c 退出 debugclient,此时 netstat 验证端口 9000 没有事件。我启动 Netbeans,打开 {webroot}/index.php并启动调试器,打开 http://127.0.0.1/index.php .然后调试器通常会正常启动。我停止调试器,回到我的项目,这就是问题真正令人烦恼的地方:有时,我可以继续正常调试我的项目,而其他时候,问题再次出现,而“Waiting to连接”标志显示,netstat 显示:
$ netstat -an | grep 9000
tcp6 0 0 :::9000 :::* LISTEN
tcp6 0 0 127.0.0.1:9000 127.0.0.1:34681 TIME_WAIT
其他时候,我会重新启动计算机,启动终端,然后找到:
$ netstat -an | grep 9000
unix 3 [ ] STREAM CONNECTED 9000
$ telnet 127.0.0.1 9000
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
我对网络和 linux 内部结构不够熟悉,看不出这意味着什么。很明显 something 正在使用端口 9000。这是什么意思?请注意,尽管我在 php.ini 中进行了设置:
$ cat /var/log/xdebug.log
cat: /var/log/xdebug.log: No such file or directory
最佳答案
如果您偶然使用 Cisco VPN 客户端,这可能是一个原因。它带有防火墙,即使客户端未启动,它也始终处于打开状态。 可以在“选项”菜单中取消选中它。
关于php - 调试IDE的端口连接到XDebug : "Waiting to Connect",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3955226/
我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
我正在使用Sequel构建一个愿望list系统。我有一个wishlists和itemstable和一个items_wishlists连接表(该名称是续集选择的名称)。items_wishlists表还有一个用于facebookid的额外列(因此我可以存储opengraph操作),这是一个NOTNULL列。我还有Wishlist和Item具有续集many_to_many关联的模型已建立。Wishlist类也有:selectmany_to_many关联的选项设置为select:[:items.*,:items_wishlists__facebook_action_id].有没有一种方法可以
我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test
我使用的是Firefox版本36.0.1和Selenium-Webdrivergem版本2.45.0。我能够创建Firefox实例,但无法使用脚本继续进行进一步的操作无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055)错误。有人能帮帮我吗? 最佳答案 我遇到了同样的问题。降级到firefoxv33后一切正常。您可以找到旧版本here 关于ruby-无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055),我们在StackOverflow上找到一个类
我正在尝试从Postgresql表(table1)中获取数据,该表由另一个相关表(property)的字段(table2)过滤。在纯SQL中,我会这样编写查询:SELECT*FROMtable1JOINtable2USING(table2_id)WHEREtable2.propertyLIKE'query%'这工作正常:scope:my_scope,->(query){includes(:table2).where("table2.property":query)}但我真正需要的是使用LIKE运算符进行过滤,而不是严格相等。然而,这是行不通的:scope:my_scope,->(que
我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub
GivenIamadumbprogrammerandIamusingrspecandIamusingsporkandIwanttodebug...mmm...let'ssaaay,aspecforPhone.那么,我应该把“require'ruby-debug'”行放在哪里,以便在phone_spec.rb的特定点停止处理?(我所要求的只是一个大而粗的箭头,即使是一个有挑战性的程序员也能看到:-3)我已经尝试了很多位置,除非我没有正确测试它们,否则会发生一些奇怪的事情:在spec_helper.rb中的以下位置:require'rubygems'require'spork'