【发布时间】:2021-12-18 12:53:42
【问题描述】:
我在 VirtualBox 上设置了自己的 Debian 服务器,一切正常,除了 Xdebug 无法启动。在服务器上,我有 Symfony 3 应用程序,它使用 vhost admin.localwww.pl 和 HTTPS。
我的php -v 结果:
PHP 7.3.31-2+0~20211022.89+debian11~1.gbp745ac7 (cli) (built: Oct 22 2021 12:37:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.31, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.31-2+0~20211022.89+debian11~1.gbp745ac7, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
我的 xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_host=127.0.0.1
xdebug.remote_port = 9003
xdebug.idekey = PHPSTORM
xdebug.mode=debug
xdebug.show_error_trace = 1
xdebug.remote_autostart = 1
我的 PhpStorm 设置:
当我运行 PHP 远程调试配置时,我看到:
无论我在 URL 中添加 ?XDEBUG_SESSION_START=PHPSTORM 还是在 Google Chrome 中使用 Xdebug Helper,效果都是一样的:尽管设置了断点,但什么也没有发生。
我在 VM 上的远程服务器上使用 PHP CLI:
编辑:我当前的配置,但仍然无法正常工作:
zend_extension=xdebug.so
xdebug.idekey=PHPSTORM
xdebug.mode=develop,debug
xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1
xdebug.client_port = 9003
【问题讨论】:
-
PHPStorm 是否在虚拟机上运行?还是 PHP 在 VM 上运行,PHPstorm 在主机上运行?
-
@viko PHP Storm 在主机上,PHP+nginx+php-fpm 在虚拟机上
-
PHP xdebug 必须与主机连接。所以
client_host参数应该去主机。请尝试从 VM ping 主机并在此参数中使用此 IP/主机名。我猜应该是:xdebug.client_host = 10.0.2.2 -
@viko 当我重新启动服务器时一切正常:D
-
@PawelC - 酷 :) 不客气 -> miłej zabawy。