从命令行进行xdebug分析不起作用

时间:2014-07-31 21:04:47

标签: php xdebug

当我尝试运行xdebug profiling(从命令行)时,脚本立即死亡。我没有收到任何反馈。 (如果我在关闭xdebug profiling的情况下运行脚本,那么脚本就会像我期望的那样执行。)我在Centos 6中运行php 5.4.13。

我尝试了两种不同的方法来启用性能分析:编辑php.ini,并在执行脚本时使用-d标志。

我的php.ini的相关部分如下所示:

[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = 1
xdebug.default_enable = 0
xdebug.profiler_output_dir = "/tmp/profiling"
# xdebug.profiler_enable = 1  # I uncomment this line to try to profile my script

我使用这两个命令中的一个来调用脚本(并确保ini文件行被注释掉(或不符合))。

$> /usr/bin/php scripts/daemon/PostProcess.php -c 4

$> /usr/bin/php -d xdebug.profiler_enable=1 scripts/daemon/PostProcess.php -c 4

我确信正在正确解释设置。

$> php -d xdebug.profiler_enable=1 --info | grep profile | less

xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => On => On
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp/profiling => /tmp/profiling
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p

xdebug可以正常进行调试。以下命令可以正常工作:

$> /usr/bin/php -d xdebug.remote_autostart=On -d xdebug.remote_host=A.B.C.D scripts/daemon/PostProcess.php -c 4

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

尝试使用-ddisplay_errors = 1运行脚本以强制显示PHP错误。示例:

const Comments = (props) => {
  return (

    <Input style={styles.field}
      ...// other stuff
      onChangeText={props.onChangeText}
    />

    </View>
  )
}

通常,遇到您描述的问题时,我的代码中有一个错误,并且默认情况下display_errors处于关闭状态,以防止潜在地泄漏错误消息中的敏感细节。因此,带有错误的消息将被隐藏。看看这是否为您提供了纠正问题的信息。