netbeans如何调试php,netbeans xdebug 调试PHP discuz详解

本文介绍了如何在Windows环境下下载并配置Xdebug与Apache的集成,详细步骤包括下载Xdebug,根据PHPinfo()的输出配置Xdebug,修改php.ini文件添加Xdebug扩展,以及在NetBeans中设置调试。通过这些步骤,可以在非线程安全的PHP环境中成功进行调试。
摘要由CSDN通过智能技术生成

素材:

xampp-win32-5.6.28-1-VC11-installer.exe

netbeans-8.0.2-php-windows.exe

一.下载对应的xdebug

phpinfo()输出复制到

https://xdebug.org/wizard.php

给出如下操作提示

Summary

Xdebug installed: no

Server API: Apache 2.0 Handler

Windows: yes - Compiler: MS VC11 - Architecture: x86

Zend Server: no

PHP Version: 5.6.28

Zend API nr: 220131226

PHP API nr: 20131226

Debug Build: no

Thread Safe Build: yes

Configuration File Path: C:\Windows

Configuration File: E:\xampp\php\php.ini

Extensions directory: E:\xampp\php\ext

Instructions

Move the downloaded file to E:\xampp\php\ext

Edit E:\xampp\php\php.ini and add the line

zend_extension = E:\xampp\php\ext\php_xdebug-2.5.4-5.6-vc11.dll

Restart the webserver (曾以为

Thread Safe的不能调试,其实是能的)

二.添加php.ini中的xdebug 信息

综合了几篇文章的,其实很多默认就对。

[Xdebug]

;指定Xdebug扩展文件的绝对路径

;zend_extension="d:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll"

zend_extension = E:\xampp\php\ext\php_xdebug-2.5.4-5.6-vc11.dll

xdebug.remote_enable=on

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

;xdebug.idekey="netbeans"

xdebug.auto_trace=on

xdebug.collect_params=on

xdebug.collect_return=on

xdebug.trace_output_dir="D:/php/debuginfo"

xdebug.profiler_enable=on

xdebug.profiler_output_dir="D:/php/debuginfo"

;启用性能检测分析

xdebug.profiler_enable=on

;启用代码自动跟踪

xdebug.auto_trace=on

;允许收集传递给函数的参数变量

xdebug.collect_params=on

;允许收集函数调用的返回值

xdebug.collect_return=on

;指定堆栈跟踪文件的存放目录

xdebug.trace_output_dir="D:/debug"

;指定性能分析文件的存放目录

xdebug.profiler_output_dir="D:/debug"

xdebug.profiler_output_name = cachegrind.out.%t.%p

好,保存重启apache

三。NETBEANS设置调试

工具-》选项-》PHP-》调试

默认就可以。

会话ID: netbeans-xdebug默认就可以。

四。netbeans打开项目

NetBeans IDE 8.0 打开已有的 PHP 项目_百度经验

https://jingyan.baidu.com/article/f7ff0bfc7874502e26bb130b.html

文件-》新建项目-》PHP(基于现有源代码的)-》名称+路径-》浏览器地址-》完成。

NetBeans IDE 8.0 打开已有的 PHP 项目_百度经验

https://jingyan.baidu.com/article/f7ff0bfc7874502e26bb130b.html

可以调试了。

;xdebug.idekey="netbeans" 不必设置也可

五。注意

Xdebug配置提示:PHP5.3之前版本配置Xdebug时使用zend_extension_ts,对于PHP5.3以上版本,使用zend_extension。

出现XDEBUG NOT LOADED AS ZEND EXTENSION的原因是在安装Xdebug时由于我们将Xdebug的DLL文件复制到了php\ext目录下,容易以PHP扩展库的形式加载Xdebug,在php.ini文件中添加了

extension

=

php_xdebug

-

2.1

.

0

-

5.3

-

vc6

.

dll

这是错误的Xdebug安装方式,必须以zend方式加载。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值