标签: xdebug

XDebug 真的很慢

我正在尝试让 XDebug 在我的本地 wamp 安装(Uniform Server 8)上运行。

但是当我输入
xdebug.remote_enable=1时

在我的 php.ini 中,这是我的 IDE 使用 xdebug 所必需的,加载页面变得非常慢,每页慢 5 秒。不过调试器可以工作。

我以前没有使用过 xdebug,但我可以想象它通常不应该花这么长时间。我很确定这可能与使用 symfony2 框架有关。

有谁知道是什么原因造成的?

apache xdebug symfony

5
推荐指数
1
解决办法
8960
查看次数

通过 file_get_contents 传递 PHP xdebug 上下文

我用来file_get_contents()查询 PHP 应用程序的另一部分。我很乐意构建一个“POST”甚至多部分查询来模拟文件上传,但我似乎无法弄清楚如何将挂钩的处理file_get_contents()放入我现有的 xdebug 会话中(正在工作,因为我可以逐步完成查询处理)。

我尝试过传递XDEBUG_SESSION当前正在处理的请求中的 cookie,但它似乎没有达到我想要的效果。

php xdebug file-get-contents

5
推荐指数
0
解决办法
344
查看次数

我可以让 xdebug 在出现异常时停止\中断吗?(Ubuntu/Netbeans IDE/PHP 5.4/CLI/xdebug)

我正在运行 PHP CLI 应用程序。

如果我设置了一个断点,xdebug 就会停止在该断点上。如果我写xdebug_break();它也会停止。

如果应用程序抛出异常,我可以让它停止吗?

我的ini文件:

php-i | grep php.ini 加载的配置文件 => /etc/php5/cli/php.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
Run Code Online (Sandbox Code Playgroud)

php xdebug

5
推荐指数
1
解决办法
1203
查看次数

在查询处启动调试而不使用 XDEBUG_SESSION_START

我在 PHPStrom 中创建了基本的 PHP Web 应用程序启动配置,它使用Xdebug. 但是,点击运行后,查询参数XDEBUG_SESSION_START将添加到 URL 末尾,并且由于我的应用程序的性质,这会导致应用程序内部出现一些错误。那么,有没有办法停止在 URL 末尾添加该参数,或者将该参数添加为 URL 中的第一个查询参数?

php xdebug phpstorm

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

展开 Laravel 堆栈跟踪

我在日志中收到如下所示的堆栈跟踪:

[2015-01-28 00:33:12] local.ERROR: exception 'ErrorException' with message 'preg_replace(): Parameter mismatch, pattern is a string while replacement is an array' in /vagrant/vendor/laravel/framework/src/Illuminate/Support/helpers.php:900
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'preg_replace():...', '/vagrant/vendor...', 900, Array)
#1 /vagrant/vendor/laravel/framework/src/Illuminate/Support/helpers.php(900): preg_replace('/\\?/', Array, 'update `company...', 1)
#2 /vagrant/vendor/laravel/framework/src/Illuminate/Database/QueryException.php(55): str_replace_array('\\?', Array, 'update `company...')
#3 /vagrant/vendor/laravel/framework/src/Illuminate/Database/QueryException.php(37): Illuminate\Database\QueryException->formatMessage('update `company...', Array, Object(ErrorException))
#4 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(627): Illuminate\Database\QueryException->__construct('update `company...', Array, Object(ErrorException))
#5 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(581): Illuminate\Database\Connection->runQueryCallback('update `company...', Array, Object(Closure))
#6 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(394): Illuminate\Database\Connection->run('update `company...', Array, Object(Closure))
#7 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Connection.php(339): Illuminate\Database\Connection->affectingStatement('update `company...', Array)
#8 /vagrant/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1911): Illuminate\Database\Connection->update('update `company...', Array)
#9 …
Run Code Online (Sandbox Code Playgroud)

php debugging xdebug laravel laravel-4

5
推荐指数
0
解决办法
1045
查看次数

使用 XDebug 调试 Magento API 调用

我必须调试一个通过 API v1(通过 Zend_XmlRpc_Client)与 Magento 商店通信的应用程序(我们称之为应用程序 A)。

以下是 XDebug 在我的 php.ini 上的配置方式。

xdebug.remote_enable = 1
xdebug.remote_host = 10.0.2.2
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
xdebug.trace_enable_trigger = 1
xdebug.trace_output_dir = "/var/www/xdebug_profile"
xdebug.profiler_enable_trigger = 1
;xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/var/www/xdebug_profile"
xdebug.remote_log = "/var/www/xdebug_profile/xdebug.log"
Run Code Online (Sandbox Code Playgroud)

当我通过浏览器访问 Magento 商店并启用调试(使用 Xdebug chrome 扩展)时,我可以调试我的 Magento 商店。

我想从我的应用程序 A 执行同样的操作。我想通过浏览器访问我的应用程序 A,并能够调试通过 API 调用执行的 Magento 代码。我尝试通过这种方式将 cookie 传递给 XML RPC 客户端(参见本文: http: //inchoo.net/magento/magento-xdebug/):

$xmlrpc_client->getHttpClient()->setCookie('XDEBUG_SESSION', 'PHPSTORM');
Run Code Online (Sandbox Code Playgroud)

但这不起作用。我还尝试使用 XDEBUG_SESSION_START 作为 cookie 名称,我尝试在客户端调用的 URL 末尾传递 ?XDEBUG_SESSION_START=PHPSTORM,但它也不起作用。

仅供参考,我使用的是 vagrant 环境,两个应用程序都使用相同的 IP。这是我的 /etc/hosts …

php xdebug magento phpstorm vagrant

5
推荐指数
1
解决办法
1689
查看次数

如何在 cakephp 中运行单个测试用例方法

我使用 cakephp 测试(php 单元测试)和 xdebug 来运行服务器端代码并​​监视终端的输出,而不是使用它进行验证。
因此,每次我想从终端运行一些特定的 lib/controller/model 方法并查看输出时,我都必须注释掉其他测试用例函数。
我知道这可能不是正确的方法,但我想知道,如果有一种方法,我可以围绕蛋糕测试构建一个包装器,它将采用我想要运行的方法名称的参数?

php phpunit cakephp xdebug

5
推荐指数
1
解决办法
2697
查看次数

Visual Studio Code - Xdebug 无法工作

在 Visual Studio Code (1.9.1) (mac) 中,我设置了php-debug插件。

在调试屏幕中,我开始“监听 Xdebug ”。
之后我在我的 XAMPP 服务器(本地)上打开 index.php。
但什么也没发生。

  • 屏幕底部的蓝色条变成橙色。
  • 步过、步入和步出按钮呈灰色。
  • 此外,在监视的变量处还会出现以下错误消息:
    无法在没有连接的情况下评估代码

我尝试在以下代码上使用断点:

<?php
$i = 0;

do {
$i++;
if (!($i % 1)) {
    echo('<p>$i = ' . $i . '</p>');
    }
}
while ($i < 100);
?>
Run Code Online (Sandbox Code Playgroud)

我正在使用 XAMPP,在我的php.ini文件中,我使用端口 9000 作为 Xdebug。

zend_extension="/usr/local/Cellar/php71-xdebug/2.5.0/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote.port=9000
Run Code Online (Sandbox Code Playgroud)

我使用自制程序安装了 Xdebug。
这是我的 php 信息: phpinfo.htm
Xdebug 向导告诉我 Xdebug 已正确安装。

我的launch.json文件如下所示:

{
"version": …
Run Code Online (Sandbox Code Playgroud)

php xampp macos xdebug visual-studio-code

5
推荐指数
2
解决办法
3万
查看次数

XDebug 无法在 Docker 中打开远程调试文件“/var/log/apache2/xdebug_remote.log”

我有一个 Docker 容器,其中包含用于开发的所有 PHP7 环境,除了 xdebug 之外,一切都运行良好。扩展已启用,并且具有启用远程调试的所有正确设置,我设置了远程主机,这是可以的,但是当我向此容器内的网站发出请求时,如果我检查 apache 错误日志,我会看到此错误:

[Thu Jun 01 05:44:31.529883 2017] [:error] [pid 916] [client 172.18.0.1:40306] XDebug 无法打开远程调试文件 '/var/log/apache2/xdebug_remote.log'。,引用者: XXXXXX

文件 xdebug_remote.log 具有所有权限,因此理论上这不会成为问题。那么,有人知道问题可能是什么吗?

remote-debugging xdebug docker docker-container

5
推荐指数
0
解决办法
1019
查看次数

xDebug 无法使用 docker、vscode 和 WSL 2

我不确定是什么问题,它只是不起作用。

路由似乎有效,我的 nginx conf 文件中有一个服务器名称。例如 test.com。那个有效。

我的项目在 ubuntu 的根目录中,而不是在安装文件夹中。

我不知道还有什么可以尝试的。

调试文件

[XDebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so

xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9002
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_host=soapboxtest.com
xdebug.idekey=VSCODE
xdebug.remote_autostart=1
xdebug.remote_log=/usr/local/etc/php/xdebug.log
Run Code Online (Sandbox Code Playgroud)

启动文件

{
  "name": "Listen for XDebug",
  "type": "php",
  "request": "launch",
  "port": 9002,
  "log": true,
  "externalConsole": false,
  "pathMappings": {
    "/var/www": "${workspaceRoot}"
  },
  "ignore": [
    "**/vendor/**/*.php"
    ]
  },
Run Code Online (Sandbox Code Playgroud)

请求 cookie

"XDEBUG_SESSION" => "VSCODE"
Run Code Online (Sandbox Code Playgroud)

文件

FROM php:fpm-alpine3.11
...
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
...
Run Code Online (Sandbox Code Playgroud)

php xdebug docker docker-compose wsl-2

5
推荐指数
1
解决办法
4204
查看次数