标签: xdebug

Docker,PhpStorm和Xdebug:找不到源位置错误

我构建了一个基于php:5.6-fpm-alpine图像的图像,我运行一个基于symfony的应用程序,因此我运行cli和基于Web的php脚本.

所以我通过以下方式在我正在运行的容器上生成了一个shell:

docker exec -ti ^container_id^ /bin/sh
Run Code Online (Sandbox Code Playgroud)

在shell上我导出了以下环境变量:

export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"
export XDEBUG_CONFIG="idekey=PHPSTORM"
Run Code Online (Sandbox Code Playgroud)

并且已按照以下链接中的说明设置IDE:

但是当我在phpstorm上启用Xdebug时,即使它正常调试我也会收到以下错误消息:

错误显示在我的PHPSTORM运行实例中

你知道为什么会这样吗?

php xdebug phpstorm docker

11
推荐指数
1
解决办法
2589
查看次数

在 VS Code 中调试时如何关闭警告?

我正在使用 XDebug(PHP Debug扩展)在 VS Code 中调试 PHP 应用程序并收到如下错误:

VS Code PHP 调试错误

我知道问题是什么以及如何解决它,但解决方案是如此庞大,以至于我目前无法解决此类错误。

我想开始使用 VS Code 进行 PHP 开发。我将 Visual Studio 与“用于 Visual Studio 的 PHP 工具”一起使用,但没有出现此问题。

在请求发生时加载的第一个脚本中,我有error_reporting(E_ALL^E_WARNING^E_NOTICE);,它应该抑制这样的错误。但似乎 VS Code 调试器忽略了它。我没有找到任何PHP Debug可以帮助我解决这个问题的设置。

有什么方法可以告诉 VS Code Debugger 忽略/不显示此类错误?

php xdebug visual-studio-code

11
推荐指数
1
解决办法
4283
查看次数

如何让PHP魔术常量__FILE__与Eclipse和PDT一起使用

最近,当我用XDebug调试一些PHP文件时(在Ubuntu上的Eclipse下),我遇到了一个奇怪的行为:

print(__FILE__);
Run Code Online (Sandbox Code Playgroud)

结果

"xdebug eval"
Run Code Online (Sandbox Code Playgroud)

GEE!

所以这个神奇的常数似乎适用于此.

任何人都知道修复或可行的解决方法?如何调试调试器?(硬编码路径是PITA!)

php eclipse xdebug

10
推荐指数
2
解决办法
2635
查看次数

Xdebug - 更改var_dump嵌套级别

你好我启用了Xdebug扩展,但是当我转储一个长数组(比如1000个位置)时,xdebug会压缩值...是否有可能关闭抑制,而不是Xdebug插件......

这里有一个例子给你们..

object(stdClass)[213]
  public 'OrderGetByStatusResult' => 
    object(stdClass)[214]
      public 'OrderDTO' => 
        array (size=3)
          0 => 
            object(stdClass)[215]
              ...
          1 => 
            object(stdClass)[230]
              ...
          2 => 
            object(stdClass)[266]
              ...
Run Code Online (Sandbox Code Playgroud)

php xdebug

10
推荐指数
1
解决办法
4352
查看次数

使用预准备声明时,"不允许属性访问"警告

我正在尝试使用AES_ENCRYPT()编码密码来登录系统.但是在尝试实现这些代码时,我从xdebug得到了一些警告:

...
$key = 'd0gis=SUPER-cute';
$sql = "SELECT * FROM `users2` WHERE username = ? AND pwd = AES_ENCRYPT(?, ?)";
$stmt = $conn->stmt_init();
$stmt->prepare($sql);
$stmt->bind_param('sss', $username, $password, $key);
$stmt->execute();
$stmt->store_result();
...
Run Code Online (Sandbox Code Playgroud)

当调试器遇到第8行或第$stmt->prepare($sql);6 行时,来自xdebug的相同警告表说:

(!)警告:main():在第8行的D:\ xampp\htdocs\learnphp\includes\authenticate_mysqli.inc.php中不允许属性访问

错误属性$stmt是空的,我没有真正的问题,但我只是想知道是什么导致出现此警告消息.

用Google搜索此警告消息但未找到任何解决方案:

  1. 使用预准备语句更新查询
  2. http://php.net/manual/en/mysqli-stmt.param-count.php

php mysql mysqli xdebug prepared-statement

10
推荐指数
1
解决办法
2万
查看次数

Ubuntu phpstorm:解释器未指定或有效

我在Ubuntu上的phpstorm上配置调试器.我很容易C:xampp/php在Windows上正确设置解释器的路径.但是linux应该有不同的解释路径.

问题

我在这个网站上搜索了很多,也在谷歌搜索,但无法得到答案.什么应该是PHP的解释器路径,以便phpstorm识别它,从而我可以做调试?有什么遗漏?

谢谢.

php ubuntu xdebug jetbrains-ide phpstorm

10
推荐指数
1
解决办法
2万
查看次数

IntelliJ,PhpStorm:使用xdebug进行调试会忽略XDEBUG_SESSION cookie

我正在尝试使用Intellij中的PHP插件调试Drupal网站(在PhpStorm中也是如此).

我有以下设置:

Chrome浏览器指向localhost别名,mydomain.local并安装XDebug Helper扩展并设置为Debug.在Cookies下的开发人员工具中,我可以看到XDEBUG_SESSIONcookie设置为PHPSTORM.

我使用以下设置使用xdebug插件配置了php:

xdebug.extended_info = 1
xdebug.idekey = "PHPSTORM"
xdebug.max_nesting_level = 500
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_mode = req
xdebug.remote_port = 9000
Run Code Online (Sandbox Code Playgroud)

在IntelliJ中,我设置了一个服务器指向mydomain.local并在运行配置中我正在使用该服务器并将Ide键设置为PHPSTORM.

现在的问题是:

如果我在PHP脚本的第一行启用Break,那么调试器会立即在第一个可破坏的位置中断index.php.如果我禁用该选项,我会收到一个警告,即没有命中断点,即使我设置了断点并且我确定代码正在执行.我看到的警告看起来像这样:

Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized
local and remote projects.
To figure out the …
Run Code Online (Sandbox Code Playgroud)

php xdebug intellij-idea phpstorm

10
推荐指数
2
解决办法
2753
查看次数

将 Xdebug 与 PhpStorm 和 WSL 结合使用

我使用 Windows 10 中的 WSL(Ubuntu 16.14)作为带有 PHP 7.1 fpm 和 Apache 的 Web 服务器。

我想将 PhpStorm 2018 中的 Xdebug 与 WSL 一起使用,但效果不佳。

Xdebug 安装在我的 Ubuntu 服务器上并且运行良好,我在phpinfo()输出中看到它。

这里是 Xdebug 的 php.ini 配置:

[Xdebug]
zend_extension="/usr/lib/php/20170718/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port = 9001
xdebug.idekey = PHPSTORM
Run Code Online (Sandbox Code Playgroud)

我在 php Storm 中也将端口配置为 9001。

问题更多是在 PhpStorm 和 WSL 之间的连接上。我用远程方式试试。在Run > Edit config弹出窗口中,我使用 PHP 网页,当我使用验证工具时,除远程主机外一切正常。我将它设置为 127.0.0.1,这就是重点。

当我听调试工具时,它说:端口 9001 繁忙

如何在 localhost 和 localhost 之间建立链接?

php xdebug phpstorm windows-subsystem-for-linux

10
推荐指数
1
解决办法
4569
查看次数

XDebug 断点在 Visual Studio Code 中给出 PHP 错误

我正在尝试使用 XDebug 和 Visual Studio Code 在 PHP 代码中设置断点,这些代码都安装在 Ubuntu Hyper-V 虚拟机上。我使用的是 PHP 7.2。

每当我在 PHP 代码中设置断点并刷新应该命中断点的页面时,我都会收到错误“命令不可用”和“没有这样的断点”显示在 Visual Studio 代码的弹出窗口中。我还在调试控制台中收到以下错误。

XDebugError: command is not available
    at new Response (/home/ben/.vscode/extensions/felixfbecker.php-debug- 
1.13.0/out/xdebugConnection.js:56:19)
    at new BreakpointSetResponse (/home/ben/.vscode/extensions/felixfbecker.php-debug- 
1.13.0/out/xdebugConnection.js:207:9)
    at Connection.<anonymous> (/home/ben/.vscode/extensions/felixfbecker.php-debug 
1.13.0/out/xdebugConnection.js:599:20)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ben/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:4:58) {
  code: 5,
  name: 'XDebugError'
}
Run Code Online (Sandbox Code Playgroud)

根据我的研究,我认为问题在于 XDebug 不适用于 IPv6,但调试器正在侦听 v6。如果我这样做netstat -an | grep 9000,我得到

tcp6       0      0 :::9000                 :::*                    LISTEN  
Run Code Online (Sandbox Code Playgroud)

以下是内容 /etc/php/7.2/fpm/conf.d/20-xdebug.ini

zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1 …
Run Code Online (Sandbox Code Playgroud)

php xdebug visual-studio-code

10
推荐指数
1
解决办法
709
查看次数

在 M1 Apple 上安装 PHP 7.4 的 Xdebug

我想用 M1 在我的 Mac 上安装 Xdebug。由于我参加的项目,我使用 PHP 7.4.32。我无法切换 PHP 版本。

当我尝试安装 Xdebug 时,它说我的 PHP 版本必须更新到 8.0.0,但我仍然想使用 7.4.32。

$ pecl install xdebug
> pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.32
No valid packages found
install failed
Run Code Online (Sandbox Code Playgroud)

当前的 PHP 版本是随 homewbrew 安装的。

$ brew services list
php          none  19968 user  ~/Library/LaunchAgents/homebrew.mxcl.php.plist
php@7.4      started      user  ~/Library/LaunchAgents/homebrew.mxcl.php@7.4.plist
php@8.0      none 
Run Code Online (Sandbox Code Playgroud)

我也运行brew update命令。一切安好。

如何安装 PHP 7.4.32 的 Xdebug?

php debugging homebrew xdebug php-7.4

10
推荐指数
1
解决办法
8247
查看次数