`
ant04444
  • 浏览: 23029 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

Debugging PHP using Xdebug and Notepad++

    博客分类:
  • php
 
阅读更多

I am sure all of you have used ‘echo’ and ‘print_r’ to debug PHP.

We all know that this way debugging is hard and you need to remember to remove them from production server.

Well, thanks to xdebug you can now debug, and you don’t need expensive or blotted IDE for that, just plain and simple Notepad++ can do the job.open php.ini in wamp

In this post we will setup xdebug and DBGp plugin with Notepad++.

Let’s start by installing xdebug.

  1. Download the latest release of xdebug for PHP version you are using.
  2. Copy xdebug dll file into php’s extension directory, in my case, as I use wamp, it is c:\wamp\php\ext .
  3. Now we need to configure xdebug so that it get recognized by PHP, so open php.ini
  4. Add following at the end of your php.ini file
    [xdebug]
    zend_extension_ts="c:/wamp/php/ext/php_xdebug-2.0.3-5.2.5.dll"
    xdebug.profiler_output_dir = "c:/wamp/tmp/xdebug"
    xdebug.profiler_output_name = "cachegrind.out.%p"
    xdebug.profiler_enable = 0
    xdebug.profiler_append=0
    xdebug.extended_info=1
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.idekey=xdebug
    xdebug.remote_log="c:/wamp/tmp/xdebug/xdebug_remot.log"
    xdebug.show_exception_trace=0
    xdebug.show_local_vars=9
    xdebug.show_mem_delta=0
    xdebug.trace_format=0
  5. Just create a folder ‘xdebug’ in ‘c:\wamp\tmp’ folder.
  6. Finally restart Apache service .

With these steps you have, finished xdebug installation, it is configured for profiling application and remote debugging. Check documentation to know what all these configuration do, and tweak according to your preference.

 

We will now install DBGP plugin for Notepad++. Make sure you have latest version of Notepad++ is installed.

  1. Download the latest release of DBGp Plugin.
  2. Unzip and move dbgpPlugin.dll file to plugins folder of your notepad++ installation folder, in my case the path is “C:\Program Files\Notepad++\plugins”.
  3. Check out the readme.txt file, that is bundled with plugin, to make sure we don’t miss anything.
  4. Now open Notepad++, and you should see DBGp option in plugins menu.

dbgp plugin for notepad++

Well we are now almost finished with setup, only ting remaining is to configure DBGP to listen to right port and we are done.

Goto “Plugins->DBGp->Config” to open the configuration screen of DBGp plugin.

DBGp Configuration window

Fill the details as shown in the image above. IDE KEY should be same to the one you specified in php.ini settings above. Click Ok and you are done.

To start debugging just add “?XDEBUG_SESSION_START=session_name” at end of you url. ‘session_name’ could be anything you want to keep.

分享到:
评论

相关推荐

    dbgpPlugin.dll Notepad++ DBGp插件

    标题中的“dbgpPlugin.dll”是指Notepad++编辑器的一个扩展插件,它与DBGp(Debugging Protocol)协议相关,用于增强Notepad++的调试功能。Notepad++是一款流行的、免费的源代码编辑器,尤其在程序员和开发者中广受...

    notepad++ DBGpPlugin

    对于PHP开发,通常会配置到本地的Xdebug服务器。同时,确保Notepad++能够正确识别待调试的文件路径,这通常是通过设置“Document Root”来完成的。 一旦配置完成,就可以开始调试之旅了。在代码中设置断点,通过...

    DBGpPlugin_0_12b_dll.zip

    DBGpPlugin就是为了解决这个问题而存在的,它引入了调试功能,使Notepad++能够与 DBGp (Debugging Protocol) 协议兼容,从而实现PHP代码的调试。 DBGp是Xdebug调试器使用的协议,Xdebug是一款强大的PHP扩展,提供了...

    Debugging Tools for Windows(X86+X64)

    Debugging Tools for Windows (x64)和Debugging Tools for Windows (x86) 微软Debugging Tools for Windows工具,简称windbg,查看dmp文件,调试驱动程序、应用程序等。

    高清彩版 Advanced+Apple+Debugging+&+Reverse+Engineering,+2nd+Edition

    高清彩版 Advanced+Apple+Debugging+&+Reverse+Engineering,+2nd+Edition_Explore+code+through+LLDB,+Python+and+DTrace-Derek+Selander

    Advanced Apple Debugging & Reverse Engineering v3.0+Code

    全面升级 Xcode 10, Swift 4.2,是一本关于iOS调试和反编译不可多得的资料!

    Linux_Debugging_and_Performance_Tuning_Tips_and_Techniques.rar

    "Linux_Debugging_and_Performance_Tuning_Tips_and_Techniques.rar"这个压缩包文件显然包含了一个关于这个主题的资源,如".chm"文件,这通常是一个Windows帮助文档,里面可能包含了丰富的教程和指南。 Linux调试...

    Apple Debugging and Reverse Engineering V3.0 PDF+epub+code

    《Apple Debugging and Reverse Engineering V3.0》是一本深入探讨苹果系统调试和逆向工程的资源合集,包括PDF和epub格式的电子书,以及可能附带的代码示例。这本书旨在帮助读者提升使用LLDB(LLVM Debugger)进行...

    C# winform 记事本 notepad源码

    10. **调试和测试(Debugging and Testing)**:开发过程中,调试和测试是必不可少的环节。Visual Studio提供了强大的调试工具,可以帮助开发者定位和修复代码中的错误。 以上就是基于C# 2003的WinForm记事本项目的...

    xdebug helper 1.6.1 crx for chrome

    This extension is very useful for PHP developers that are using PHP tools with Xdebug support like PHPStorm, Eclipse with PDT, Netbeans and MacGDBp or any other Xdebug compatible profiling tool like ...

    Advanced+Apple+Debugging+&+Reverse+Engineering,+2nd+Edition-Selander(2017).pdf

    I mean, if the developer had a complete understanding of the program, there wouldn’t be any bugs and they wouldn’t be debugging in the first place, right? Don’t think like that. There are always ...

    Debugging(VisualC++)

    在软件开发过程中,调试是必不可少的一个环节,尤其是在使用像Visual C++这样的强大开发工具时。Visual C++提供了丰富的调试功能,帮助程序员定位并修复代码中的错误。本文将深入探讨使用Visual C++进行调试的关键...

    Inside Windows Debugging - Practical Debugging and Tracing Strategies 无水印pdf

    Inside Windows Debugging - Practical Debugging and Tracing Strategies 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 ...

    vi+Emacs+GCC+Make+GDB+Bash经典书籍

    Debugging+With+Gdb,+9Th+Ed.pdf Learning_GNU_Emacs_Third_Edition.chm Linux.Commands.Editors.and.Shell.Programming.chm Managing+Projects+with+GNU+Make.pdf O'Reilly.Bash.Cookbook.May.2007.pdf ...

    vi+Emacs+GCC+Make+GDB+Bash经典书籍4

    Debugging+With+Gdb,+9Th+Ed.pdf Learning_GNU_Emacs_Third_Edition.chm Linux.Commands.Editors.and.Shell.Programming.chm Managing+Projects+with+GNU+Make.pdf O'Reilly.Bash.Cookbook.May.2007.pdf Prentice....

    vi+Emacs+GCC+Make+GDB+Bash经典书籍7

    Debugging+With+Gdb,+9Th+Ed.pdf Learning_GNU_Emacs_Third_Edition.chm Linux.Commands.Editors.and.Shell.Programming.chm Managing+Projects+with+GNU+Make.pdf O'Reilly.Bash.Cookbook.May.2007.pdf Prentice....

    vi+Emacs+GCC+Make+GDB+Bash经典书籍1

    Debugging+With+Gdb,+9Th+Ed.pdf Learning_GNU_Emacs_Third_Edition.chm Linux.Commands.Editors.and.Shell.Programming.chm Managing+Projects+with+GNU+Make.pdf O'Reilly.Bash.Cookbook.May.2007.pdf Prentice....

Global site tag (gtag.js) - Google Analytics