有没有像 ruby​​ 的调试器一样的交互式 php 调试器?

发布于 2024-07-14 18:19:54 字数 212 浏览 5 评论 0原文

我观看了 使用 Rails 2 在 15 分钟内创建博客,在视频中 9 分钟后,他展示了 ruby​​ 的交互式调试器,它允许您从正在运行的脚本中调用函数/方法。

这远远超出了断点的范围,看起来非常有用。

PHP 有提供类似功能的东西吗?

I watched the Creating a weblog in 15 minutes with Rails 2 and after 9 minutes in the video he shows ruby's interactive debugger, which allows you to call functions/methods from within a running script.

This goes way beyond breakpoints and looks very useful.

Is there something for PHP that gives similar functionality?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绿萝 2024-07-21 18:19:54

安装xdebug,然后使用提到的调试客户端之一此处

Install xdebug and then use one of the debug clients mentioned here.

铁轨上的流浪者 2024-07-21 18:19:54

虽然 Milen 的答案是 2009 年左右唯一正确的答案,并且 Xdebug 仍然是一个有用的工具,但使用它需要您重新编译您的PHP 或编辑 php.ini 运行时配置以将其加载为共享对象。 它还意味着使用支持其网络协议的特定客户端应用程序,例如 PhpStorm 等 IDE。

另一种选择是 phpdbg,它是一个交互式调试器,附带 PHP 核心版本 5.6 及更高版本,并且可以调试为符合 PHP 5.4 或更高版本而编写的 PHP 脚本。

使用它很简单:

phpdbg php_script_i_want_to_debug.php

进入调试器后,输入 help 以访问帮助菜单。

如果您的系统上还没有 phpdbg,可能是因为您的 PHP 配置没有使用 --enable-phpdbg 选项。 您可以:

  1. 重新编译 PHP,确保在运行 ./configure 时添加 --enable-phpdbg (这也将简单地构建 phpdbg code> 二进制文件),或者
  2. 独立下载 phpdbg 源代码并针对您安装的 PHP 进行编译(假设您有可用的 PHP 源代码)。 执行此操作的说明虽然很少,但位于此处

Although Milen's answer is the only correct one circa 2009, and Xdebug is still a useful tool, using it requires you to recompile your PHP or to edit your php.ini runtime configuration to load it as a shared object. It also means using a specific client application that supports its network protocol, such as an IDE like PhpStorm.

An alternative is phpdbg, which is an interactive debugger that ships with PHP core versions 5.6 and later and can debug PHP scripts written to conform to PHP 5.4 or later.

Using it is simple:

phpdbg php_script_i_want_to_debug.php

Once in the debugger, type help to access the help menu.

If you don't already have phpdbg on your system, it may be because your PHP was configured without the --enable-phpdbg option. You can either:

  1. Recompile your PHP, being sure to add --enable-phpdbg when you run ./configure (this will simply also build the phpdbg binary), or
  2. download the phpdbg source independently and compile it against your installed PHP (assuming you have the PHP source available). Instructions for doing that, while sparse, are here.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文