首页 > 解决方案 > 在 NetBeans 中调试 php

问题描述

我只是想在 netbeans 中调试 php 代码以了解如何去做,我已经安装了 google chrome netbeans 扩展,但是当我尝试调试我的代码时,一个窗口显示:

“需要 netbeans 连接器 chrome 扩展
要使用 NetBeans 连接器在 Chrome 中运行您的项目,您必须首先在 Chrome Web Store 中安装 NetBeans 连接器扩展。”

另外,我在本地主机中打开了我的项目,当然我可以在 chrome 页面的一角看到 netbeans 图标。
谁能告诉我我做错了什么?

我的操作系统是 ubuntu 18.04
,我的堆栈是 xampp (lampp)

标签: phpdebuggingnetbeansbackendlamp

解决方案


在 Netbeans 中调试 php 的一种方法(没有 chrome 扩展):

  1. Apache 服务器运行
  2. PHP 配置
  3. 安装 php-xdebug
  4. 添加你的 php.ini:

    zend_extension=/usr/lib/php/... 到 .../xdebug.so 的路径

    xdebug.remote_enable = 1

    xdebug.remote_handler = dbgp

    xdebug.remote_host = 127.0.0.1

    xdebug.remote_mode = req

    xdebug.remote_port = 9005

在 Netbeans 中,转到工具 > 选项 > PHP

选项卡常规

  • 写下 PHP 解释器的路径

标签调试

  • 调试器端口:9000
  • 会话 ID:netbeans-xdebug

推荐阅读