在PHPStorm中运行的xdebug无法连接到远程服务器 [英] xdebug running in PHPStorm unable to connect to remote server

查看:206
本文介绍了在PHPStorm中运行的xdebug无法连接到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让xdebug在我的盒子和在远程服务器上运行的Webapp之间运行.

I'm trying to get xdebug running between my box and a webapp running on a remote server.

我正在开发箱上通过PHPStorm运行xdebug.启动调试器后,我被卡住了. PHPStorm调试器窗口挂起正在等待使用ide键'PHPStorm'的传入连接"

I'm running xdebug through PHPStorm on my development box. I get stuck after starting the debugger. The PHPStorm debugger window hangs on "Waiting for incoming connection with ide key 'PHPStorm'"

在远程服务器上,我们的系统管理员已安装xdebug.服务器具有以下设置:

On the remote server, our sys admin has installed xdebug. The server has the following settings:

xdebug.remote_port  9000
xdebug.default_enable   On  
xdebug.remote_enable    On
xdebug.remote_connect_back  On

请注意,remote_connect_back已打开.我正在为多开发人员环境配置它.这将导致xdebug.remote_host被忽略(这就是为什么我没有在其中包含它的原因).

Note that remote_connect_back is on. I'm configuring this for a multi-developer environment. This will cause xdebug.remote_host to be ignored (which is why I didn't include it up there).

我正在使用Firefox最简单的xdebug"插件.如果我在禁用xdebug插件的情况下刷新页面,则该页面可以正常加载.

I'm using the Firefox "The Easiest xdebug" addon. If I refresh a page with the xdebug addon disabled, the page loads just fine.

如果我为该页面启用了插件并刷新,则该页面将挂起直到超时.我相信这告诉我xdebug正在运行,至少要尝试执行某些操作.正确的?到目前为止一切顺利.

If I enable the addon for that page and refresh, the page will hang until timeout. I believe this tells me that xdebug is running and at least TRYING to do something. Right? So far so good.

我在我的本地开发设备上运行PHPStorm.我还在我的开发箱上安装了xdebug.这是php -i的一些相关输出:

I'm running PHPStorm on my local dev box. I have also installed xdebug on my dev box. Here's some relevant output from php -i:

xdebug support => enabled
xdebug.default_enable => On => On
xdebug.idekey => PHPStorm => PHPStorm
xdebug.remote_enable => On => On
xdebug.remote_port => 9000 => 9000
xdebug.remote_host => localhost => localhost
xdebug.remote_connect_back => Off

我在服务器上使用xdebug版本2.2.3,在客户端上使用2.2.7.我需要使用旧版本,因为我们至少停留在PHP 5.3上.客户端和服务器都运行PHP 5.3.

I'm using xdebug version 2.2.3 on the server and 2.2.7 on the client. I need to use old versions, because we're stuck on PHP 5.3... at least for now. Both client and server are running PHP 5.3.

在PHPStorm中,我设置了连接到远程服务器的服务器配置:

In PHPStorm, I set up a server config connecting to the remote server:

devops-dev.ourcloud.com

devops-dev.ourcloud.com

我有一个映射到服务器上绝对路径的路径:var/www/api/apidev.ourcloud.com/current

I have a path mapping to an absolute path on the server: var/www/api/apidev.ourcloud.com/current

正在等待端口9000.我将PHPStorm中的IDEKey设置为"PHPStorm".

Waiting on port 9000. I have my IDEKey in PHPStorm set to "PHPStorm".

我单击电话以侦听调试器连接,然后单击绿色的调试器图标,然后在调试器视图中看到:

I click the phone to listen for debugger connections and click the green debugger icon, and in the debugger view, I see:

等待使用ide键"PHPStorm"的传入连接

Waiting for incoming connection with ide key 'PHPStorm'

就是这样.我似乎没有连接到服务器.

And that's it. I don't seem to be connecting to the server.

任何线索是什么原因造成的,或者甚至我如何能够更好地调试它?

Any clue what's causing this or even how I might be able to better debug this?

推荐答案

好像是防火墙问题.我可以通过运行从客户端到服务器的ssh隧道来解决此问题:

Looks like it was a firewall problem. I was able to fix the problem by running an ssh tunnel from my client to my server:

ssh -f -N -T -R9000:localhost:9000服务器

ssh -f -N -T -R9000:localhost:9000 theserver

我还能够使用netcat从服务器到客户端找到此问题.

I was also able to find this issue using netcat from the server to the client.

从服务器:nc客户端9000

From server: nc client 9000

这表明该端口已被阻止.

That showed that the port was blocked.

这篇关于在PHPStorm中运行的xdebug无法连接到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆