gpt4 book ai didi

使用 xdebug 进行 PhpStorm 远程调试

转载 作者:可可西里 更新时间:2023-10-31 23:47:21 25 4
gpt4 key购买 nike

我想在服务器中使用 PHPstorm IDE 和 xdebug 我的站点进行调试。在本地运行完美,但是当我想配置为从服务器调试时我不能。

我在服务器中安装了 xdebug,配置如下:

xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_host=MY IP
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

然后我在 PHPSTORM 的“编辑配置”中设置了一个“PHP 远程调试”和一个“服务器”

在我放置的服务器中:

Name: xxxx
Port: 80
Host: Url of my site
Debugger: Xdebug
I checked "Use Path Mapping" and in File/Directory i put my local proyect path "/home/mysite"
In "Absolute path on the server" i put the path in the server where are the proyect: "/var/www/html/mysite"

在“PHP 远程调试”中,我输入:

Name: xxxx
Servers: the server created previously
IDE key: PHPSTORM

这些设置不起作用。我使用带有扩展 Xdebug 的 Chrome,并启用了 Ide key PHPstorm。

我工作缺少什么?

最佳答案

我想我刚孵化的时候在工作中遇到过同样的问题。当XDebug在另一台服务器上运行时,XDebug引擎的端口当然只在本地系统(远程服务器)上打开。

将该端口转移到您的开发机器的最佳方法是在这两个系统之间创建一个安全的 SSH 隧道。在您的本地计算机上,在 ssh-config-file(通常位于 ~/.ssh/config 下)中,执行以下操作:

Host example
Hostname 192.168.2.1
User johndoe
LocalFoward 9200 127.0.0.1:9000

现在 - 在控制台上 - 你做

ssh example

它将使用用户名(登录名)johndoe 连接到远程系统 (192.168.2.1),并将远程机器上的端口 9200 连接到本地机器上的端口 9000。当然,您也可以为两者使用相同的端口。

希望对您有所帮助。 :)

关于使用 xdebug 进行 PhpStorm 远程调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29871618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com