在 Ubuntu 上使用 PhpStorm 进行 Xdebug [英] Xdebug with PhpStorm on Ubuntu

查看:43
本文介绍了在 Ubuntu 上使用 PhpStorm 进行 Xdebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以说明采取适当措施以确保以下设置允许 Xdebug 和 PhpStorm 工作.

I am wondering if anyone can shed any light on the appropriate measures to take to ensure that the following set up will allow Xdebug and PhpStorm to work.

我们的 LAMP 堆栈运行良好,PHP 和 Xdebug 3 运行在 Azure VM 上.

We have a LAMP stack running fine, with PHP and Xdebug 3 running on an Azure VM.

我们在一个共享的办公网络上,有一个公共 IP 地址,但无法访问传入线路的防火墙,尽管它很轻松.

We are on a shared office network with a public IP address but no access to the firewall for the incoming line, although it's very relaxed.

我们的目标是连接我们的机器 (x3) 以调试我们的远程 Web 服务器(Azure VM 上的 LAMP 堆栈).

We are aiming to connect our machines (x3) to debug our remote web server (the LAMP stack on the Azure VM).

我们可以毫无问题地创建 SSH 隧道到 Web 服务器.但是调试是行不通的.IE.当我们启动一个页面时,调试器什么都不做.

We can create the SSH tunnel no problem to the web server. But debugging just doesn't work. I.e. when we fire up a page, the debugger does nothing at all.

是否还有其他人在运行这种设置并确认我们是否遗漏了确保成功连接的步骤.

Is anyone else running this kind of set up and confirm whether we are missing a step to ensure a successful connection.

[xdebug]
zend_extension=xdebug
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.default_enable = 1
xdebug.force_display_errors = 1
xdebug.scream = 1
xdebug.force_error_reporting = NONE
xdebug.idekey = diss
xdebug.remote_enable = 1
xdebug.remote_log=/tmp/xdebug.log
xdebug.log=/var/log/xdebug.log
xdebug.remote_connect_back=0
xdebug.discover_client_host=false

推荐答案

在我的情况下,通过确保设置如下来解决此问题

This was resolved in my case by ensuring the settings were as follows

[xdebug]
zend_extension=xdebug
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.remote_log=/tmp/xdebug.log
xdebug.log=/var/log/xdebug.log

我使用 pydbgpproxy

I use pydbgpproxy

    cd /opt
    sudo mkdir pydbgpproxy
    cd pydbgpproxy
    sudo wget https://github.com/Mirocow/pydbgpproxy/archive/master.zip ./
    sudo unzip master.zip ./
    sudo ln -s $(pwd)/pydbgpproxy /usr/local/bin/pydbgpproxy

编辑 pydbgpproxy

Edit the pydbgpproxy

cd /opt/pydbgpproxy/pydbgpproxy-master/
sudo nano pydbgpproxy 

在第 333 行中,将行 add=xxx 替换为

In line 333 replace line add=xxx with

addr = ['127.0.0.1',long(idekey)]

在服务器上启动pydbgproxy

Start pydbgproxy on the server

nohup sudo /opt/pydbgpproxy/pydbgpproxy-master/pydbgpproxy -i 127.0.0.1:1001-d 127.0.0.1:1003 &

使用 SSH 隧道创建到开发服务器的 SSH 连接:

Create an SSH connection to the development server with an SSH tunnel:

Source Port: 1234 **This must match your unique IDE key set below.**
Destination: 127.0.0.1:1003

在 PhpStorm 中将调试器端口更改为 9003<代码>文件>设置 >语言&框架 >PHP >调试

Change your debugger port to 9003 in PhpStorm File > Settings > Languages & Frameworks > PHP > Debug

Debug Port: 1003

将您的代理设置更改为:<代码>文件>设置 >语言&框架 >PHP >调试DBGp 代理

Change your proxy settings to: File > Settings > Languages & Frameworks > PHP > Debug > DBGp Proxy

IDE Key: 1234 **Unique IDE Key - This must be unique to you and must be numerical**
Host: 0.0.0.0 **External IP Address of the Dev Server**
Port: 1001

确保您的 xdebug 辅助扩展设置为使用密钥 1234

Make sure your xdebug helper extension is set to use key 1234

您在上面设置的 IDE 密钥必须是唯一的

这篇关于在 Ubuntu 上使用 PhpStorm 进行 Xdebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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