Snow Leopard 上的 var_dump() 输出不可读?
我已按如下所示配置了 xdebug,但错误输出完全不可读。 您知道设置有什么问题吗?
TIA 与最好的问候
设置:雪豹服务器上的 Apache/2.2.13 (Unix) PHP/5.3.0
来自 php.ini 的配置:
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=10.0.1.9
xdebug.remote_connect_back=0
xdebug.idekey="macgdbp"
xdebug.remote_port=10000
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
; profiler
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On
; stacktraces & var_dump() output config
xdebug.overload_var_dump=1
xdebug.show_local_vars=1
xdebug.collect_params=4
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.dump_globals=On
xdebug.show_exception_trace=On
; codetracer
xdebug.auto_trace=On
xdebug.trace_output_dir="/Users/admin/Sites/xdebugtracer"
xdebug.collect_return=On
输出:
注意:未定义变量:/Users/admin/Sites/hanak4/scripts/jwplaylist.php 中的文件第 76 行调用堆栈:0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/ jwplaylist.php:0 本地范围内的变量 (#1):
$config = class stdClass { public $showFirst = 'youtube';公共 $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *未初始化* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *未初始化* $key = *未初始化* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = 类型(未知)的资源(7) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV. flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '
警告:在第 76 行的 /Users/admin/Sites/hanak4/scripts/jwplaylist.php 中为 foreach() 提供的参数无效 调用堆栈:0.0003 648584 1. {main}() /Users/admin/Sites/hanak4 /scripts/jwplaylist.php:0 本地范围内的变量 (#1):
$config = class stdClass { public $showFirst = 'youtube';公共 $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *未初始化* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *未初始化* $key = *未初始化* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = 类型(未知)的资源(7) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV. flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '
I have xdebug configured as shown below but the error-output is totally unreadable.
Do you have an idea what's wrong with the setup?
TIA & best regards
Setup: Apache/2.2.13 (Unix) PHP/5.3.0 on Snow Leopard Server
Config from php.ini:
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=10.0.1.9
xdebug.remote_connect_back=0
xdebug.idekey="macgdbp"
xdebug.remote_port=10000
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
; profiler
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On
; stacktraces & var_dump() output config
xdebug.overload_var_dump=1
xdebug.show_local_vars=1
xdebug.collect_params=4
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.dump_globals=On
xdebug.show_exception_trace=On
; codetracer
xdebug.auto_trace=On
xdebug.trace_output_dir="/Users/admin/Sites/xdebugtracer"
xdebug.collect_return=On
Output:
Notice: Undefined variable: files in /Users/admin/Sites/hanak4/scripts/jwplaylist.php on line 76 Call Stack: 0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/jwplaylist.php:0 Variables in local scope (#1):
$config = class stdClass { public $showFirst = 'youtube'; public $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *uninitialized* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *uninitialized* $key = *uninitialized* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = resource(7) of type (Unknown) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV.flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '
Warning: Invalid argument supplied for foreach() in /Users/admin/Sites/hanak4/scripts/jwplaylist.php on line 76 Call Stack: 0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/jwplaylist.php:0 Variables in local scope (#1):
$config = class stdClass { public $showFirst = 'youtube'; public $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *uninitialized* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *uninitialized* $key = *uninitialized* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = resource(7) of type (Unknown) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV.flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你必须
在 php.ini 中进行设置,这样 xdebug 才能正确输出。
You have to set
in your php.ini, this allow xdebug to output correctly.
您是否在预标记之间打印此内容?
这应该确保格式正确。我不知道为什么没有颜色。
Are you printing this between pre tags?
That should ensure the formatting is correct. I'm not sure why there are no colors.
看起来您的错误日志没有在每个错误之间读取(或添加)换行符(或者这就是它发布到 SO 的方式?)
注意:在向问题添加代码或输出时,请使用编辑器中的代码按钮 -就是那个看起来像 101010 的那个。
It looks like your error log is not reading (or adding) a newline character between each error (or is this just how it posted to SO?)
Note: when adding code or output to a question, use the code button in the editor - it's the one that looks like 101010.
我已经找到了解决方案。从两个月前开始我就遇到了同样的“问题”。
尝试一下:
打开 MAMP ->转到文件菜单 ->编辑模板-> PHP (your-version).ini
在文件末尾取消注释 Xdebug 扩展。
您也可以设置 html_errors = On
我希望能帮助像我这样的其他人。
I have found the solution. I got the same "problem" since two months ago.
Try it:
Open MAMP -> go to File Menu -> Edit Template -> PHP (your-version).ini
In the end of file uncomment the Xdebug extension.
Also you can set html_errors = On
I hope help other like me.
如果您无法编辑 php.ini 并且您错过了添加 pre 标记,您还有另一种方法可以查看完整的错误,即在任何浏览器中查看源代码,我经常使用它来修复。
if you are not in a position to edit php.ini and also if you miss adding pre tags , you have a another way to see the complete error , by doing a view source in any browser , I often use that to fix .