且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Ubuntu 上使用 PhpStorm 进行 Xdebug

更新时间:2023-01-23 14:51:48

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

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 密钥必须是唯一的