【问题标题】:Using PHP xdebug with the PHP CLI binary from MAMP将 PHP xdebug 与 MAMP 中的 PHP CLI 二进制文件一起使用
【发布时间】:2022-07-04 22:40:13
【问题描述】:

我正在使用 MAMP 的 PHP CLI 二进制文件(即 /Applications/MAMP/bin/php/php7.2.10/bin/php)从终端执行脚本。如何使用 Xdebug 单步执行我以这种方式执行的脚本?

到目前为止,我已阅读: https://joshbuchea.com/mac-enable-xdebug-in-mamp/ Getting Xdebug Working with MAMP and Mac 其中提到了如何启用 xdebug,但只能通过从 Web 服务器调用脚本。

还有这个: Installing Xdebug for PHP CLI 在 Xdebug 上使用 XAMPP,不幸的是我发现很难推断到 MAMP。

有没有简单的方法比如:

$ phpdebugger phpfile.php

( 而不是

$ php phpfile.php

)

哪个会启动文件的调试会话?

如果xdebug不适合这个,有没有其他程序可以做到这一点?

【问题讨论】:

    标签: php xdebug


    【解决方案1】:

    我不使用 MAMP,但我用来调试 PHP CLI 的是

    export PHP_IDE_CONFIG="serverName=your.servername.com"
    php -dxdebug.client_host=xx.xx.xx.xx -dxdebug.mode=debug -dxdebug.start_with_request=yes php_command_here
    

    显然,在代码中添加断点。

    【讨论】:

      猜你喜欢
      • 2013-09-14
      • 1970-01-01
      • 2015-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-25
      • 2012-11-09
      相关资源
      最近更新 更多