嗨,我的 xdebug 连接到 PHPUnit 时遇到问题。
运行时:
phpunit --coverage-html ./report unit
Run Code Online (Sandbox Code Playgroud)
我得到:
PHPUnit 3.4.15 by Sebastian Bergmann.
The Xdebug extension is not loaded.
Run Code Online (Sandbox Code Playgroud)
当我运行 php -v
PHP 5.2.13 (cli) (built: Mar 5 2010 16:23:44)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v0.9.6, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)
当我运行 php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dbase
dom
eAccelerator
exif …Run Code Online (Sandbox Code Playgroud) 我使用 xdebug 设置了 netbeans,因此它可以调试 php。但是,这仅在我创建一个 php 项目时才有效。如果我尝试打开一个独立的 php 文件,它将不起作用。所以我的问题是,是否可以调试不属于 netbeans php 项目的独立 php 文件?
如果这是不可能的,我如何使用 netbeans 调试独立的 php 文件?
所以基本上我使用Zend Framework的自动加载器来自动加载我的功能.但是因为每当我调试时,如果我调用任何函数,xdebug会转到自动加载函数,然后再转到正在调用的实际函数.
因此,如果我调用该函数func(),它将首先进入autoload(),然后func()在时间方面增加调试成本等
理想情况下,如果我调用func(),它应该在仍然使用自动加载器时直接转到func().
有没有办法在我调试时指定xdebug(或使用任何PHP/Zend hack等)来总是跳过某个函数(在这种情况下我的自动加载函数)?
我目前正在使用 xdebug 并尝试使用 KCacheGrind 进行分析和查看。我将它设置为仅对触发器进行操作,即XDEBUG_PROFILE=1通过GET传递。
关于我正在使用的框架的输出中有很多噪音,并且希望能够专门分析我的代码块,例如控制器,而不是整个请求。
我是否可以关闭 xdebug 分析,直到我选择将其打开,就像在控制器中一样,然后在需要时将其关闭?
我正在运行Apache 2.2.19和PHP 5.2.17.我想用Xdebug配置调试,所以我去了xdebug.org并下载了:php_xdebug-2.1.2-5.2-vc6-nts.dll(我有php VC6 x86版本).我把它复制到了c:\Program Files (x86)\php\ext\php_xdebug-2.1.2-5.2-vc6-nts.dll
编辑PHP.ini(已添加):
[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_log = "c:\host\xdebug.log"
zend_extension_ts="c:\Program Files (x86)\php\ext\php_xdebug-2.1.2-5.2-vc6-nts.dll"
Run Code Online (Sandbox Code Playgroud)
但我仍然无法在phpinfo()xdebug信息中看到 - 所以它不起作用.Apache错误日志说:
Failed loading c:\Program Files (x86)\php\ext\php_xdebug-2.1.2-5.2-vc6-nts.dll
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 …Run Code Online (Sandbox Code Playgroud) 我试图找出某个对象的某个属性被修改的位置.由于PHP的高度动态性($o->$prop = $val等等),通过简单的代码分析几乎不可能做到这一点.有没有办法启动调试会话并在属性被修改的行中断?(__set通过条件xdebug_break()调用向类添加魔法可能有助于简单的情况,但如果类或其中一个祖先已经有魔术设置器,它可能变得非常复杂,因此这也不是一个好的解决方案.)
我使用的最新版本PHP (7.0.2),并xdebug (2.4.0RC3)与phpstorm 9.0.2当我开始调试我立即得到
error "502 Bad Gateway"
Run Code Online (Sandbox Code Playgroud)
有时我设法逐步执行几行代码,但是无论如何我还是得到了错误。
当我拥有的先前版本时PHP (5.6),xdebug一切都很棒。
PS php,nginx和xdebug与homebrew一起安装。
我很难将xdebug性能分析工作并整合到2017年的PhpStorm中.我试图关注此视频但没有成功.
我知道xdebug已正确安装在Web服务器上(Windows安装上的本地Apache)并正确集成到PhpStorm中,因为当我在IDE中单击"开始侦听PHP调试连接"时,我的断点会停止代码执行,我可以调试精细.我只是无法让探查器生成其文件,我甚至不知道它是否正在运行.
php.ini中
<!-- language: lang-none -->
[xdebug]
zend_extension="php_xdebug-2.5.5-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
; xdebug.profiler_enable=1 ; I've tried uncommenting. Made no difference
; xdebug.profiler_enable_trigger=1 ; I've tried uncommenting. Made no difference
xdebug.profiler_output_dir="C:\websites\tmp"
xdebug.profiler_output_name="cachegrind.out.%p"
xdebug.idekey=PHPSTORM
Run Code Online (Sandbox Code Playgroud)
在PHP执行开始时,我试图打开这样的分析:
ini_set('xdebug.profiler_enable','1');
Run Code Online (Sandbox Code Playgroud)
我还尝试使用以下命令从命令行运行脚本:
php script.php -d xdebug.profiler_enable=1
Run Code Online (Sandbox Code Playgroud)
没有错误提出.C:\websites\tmp两者中都没有创建文件.
我遇到了最简单的Xdebug扩展,但如果可以避免的话,我宁愿不依赖于另一个软件(我甚至没有尝试过它以确定它是否可行).
我了解了xdebug.remote_logini指令并将其设置为一个文件,然后重新启动了Apache.这是我在日志中看到的,当我运行正常的调试会话时(意味着我点击了PhpStorm中的"开始收听PHP调试连接"):
<!-- language: lang-none -->
Log opened at 2017-07-22 20:33:03
I: Connecting to …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用自制软件在mac上安装php56-xdebug.关于如何做到这一点的所有建议似乎已经过时了两周.
我从明显开始:
$ brew install php56-xdebug
Error: No available formula with the name "php56-xdebug"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Run Code Online (Sandbox Code Playgroud)
当我用brew search xdebug我得到
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and …Run Code Online (Sandbox Code Playgroud)