简体   繁体   English

在 Ubuntu 上使用 PhpStorm 进行 Xdebug

[英]Xdebug with PhpStorm on Ubuntu

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.我想知道是否有人可以阐明采取适当措施以确保以下设置将允许 Xdebug 和 PhpStorm 工作。

We have a LAMP stack running fine, with PHP and Xdebug 3 running on an Azure VM.我们有一个运行良好的 LAMP 堆栈,PHP 和 Xdebug 3 在 Azure 虚拟机上运行。

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.我们在一个共享的办公网络上,有一个公共的 IP 地址,但没有访问防火墙的传入线路,虽然它很轻松。

We are aiming to connect our machines (x3) to debug our remote web server (the LAMP stack on the Azure VM).我们的目标是连接我们的机器 (x3) 以调试我们的远程 web 服务器(Azure VM 上的 LAMP 堆栈)。

We can create the SSH tunnel no problem to the web server.我们可以创建 SSH 隧道到 web 服务器没有问题。 But debugging just doesn't work.但是调试是行不通的。 Ie 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

I use pydbgpproxy我使用 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

Edit the pydbgpproxy编辑 pydbgpproxy

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

In line 333 replace line add=xxx with在第 333 行将 add=xxx 行替换为

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

Start pydbgproxy on the server在服务器上启动 pydbgproxy

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

Create an SSH connection to the development server with an SSH tunnel:使用 SSH 隧道创建与开发服务器的 SSH 连接:

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

Change your debugger port to 9003 in PhpStorm File > Settings > Languages & Frameworks > PHP > Debug在 PhpStorm File > Settings > Languages & Frameworks > PHP > Debug器端口更改为 9003

Debug Port: 1003

Change your proxy settings to: File > Settings > Languages & Frameworks > PHP > Debug > DBGp Proxy将您的代理设置更改为: 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

Make sure your xdebug helper extension is set to use key 1234确保您的 xdebug 帮助程序扩展设置为使用密钥 1234

What you set as your IDE key above, must be unique您在上面设置的 IDE 密钥必须是唯一的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM