Menu

php_dbg.dll with notepad++

2006-02-05
2012-11-13
  • Nobody/Anonymous

    Has anyone implemented php_dbg with notepad++?  Or any other debugger for that matter.

     
    • shodanto

      shodanto - 2007-05-27

      It would be really great if someone had started this.

       
    • Damjan Cvetko

      Damjan Cvetko - 2007-06-02

      Hello...
      I am currently working on a plugin that does just that. It uses DBGP protocol. DBGP is language independent and there are implementations for PHP, Python, PERL (I think) and maybe more...
      Look at XDebug extension for PHP.
      Currently all my efforts are focused on PHP, but I'll get around other languages (just matter of tweaking) if there is demand for it.

      The plugin spawns one dockable dialog that is used for docking other small dialogs. Support for stack list, eval, local and global context, (sort of) support for breakpoints and of course stepping line by line... Also let's not forget remote file mappings...

      One thing that's missing is support for DBGP proxy, but you can work around that for now. A decent manual would also be a good thing.

      I am developing this plugin in Delphi because for me C++ is just a nightmare for visual development... (I have not come around to learn .NET as I spend most of my time in PHP or low-level C).

      If anybody is interested, I could use some feedback...

      LP,
      -Zobo

      P.S.: A side product of this project is a small framework for writing N++ plugins in delphi... It does need serious cleanup tho...

       
    • Nobody/Anonymous

      I followed the instruction to install php_dbg.dll in notepad++ and saw all the menu items. However, when I ran the php file with the "launch in firefox" menu item, firefox opened the file as text file without the web server processing it first. However, I can load the file correctly with http://127.0.0.1/supplier/test_i.php or http://localhost/supplier/test_i.php.

      Here is my local server configuration:
      Windows XP with WinLamp, php5.1.4

      Here is my debug configuration:
      Remote IP   IDE KEY     Remote Path                      Local Path
      127.0.01    zobo        D:\www\supplier                  D:\www\supplier

      What should I do?

       
      • Damjan Cvetko

        Damjan Cvetko - 2007-09-24

        Hi...

        First to just clear things up. If you want to you this debugger, you need:
        1. dbgpPlugin.dll  for notepad++ (the rest of you post implies this)
        2. php_xdebug.dll ( look here http://xdebug.org/ )

        You do NOT need nor CAN you use php_dbg.dll. php_xdebug uses DBGP protocol, whereas php_dbg uses DBG protocol. This client (dbgpPlugin.dll) can only be used with DBGP protocol.

        Anyway... Please explain where you found "lunch in firefox" menu item...
        The way I know how to use it is: open page in firefox (via http://localhost/...\). The debugging engine then connects the client and lets you step and evaluate.

        Now down to plugin configuration (the only part that makes sense to me anyway). I suggest that you remove the IDE key (zobo) as it can only cause problems in you case (as you don't have only one server anyway).

        Mind that there are still a few problems with the windows path mapping code that will be cleaned up in next release. I intend to write a more detailed tutorial how to set up the environment so to avoid further confusion.

        Best regards,
        -Zobo

         
        • Nobody/Anonymous

          Zobo, Thanks for your response. However, I still couldn't figure it out. Here is what I do:

          0. Downloaded NPP4.3.installer.exe and ran it. Took all the default.
          1. Downloaded the DBGP plug in. I put the dbgpPlugin.dll under C:\Program Files\Notepad++\plugins as instructed by your readme
          2. I downloaded the php_xdebug-2.0.0-5.1.6.dll from http://xdebug.org/ (for my php 5.1.4) and moved the file to C:\Program Files\Notepad++\plugins. I keep the file name as it is.
          3. After I rebooted my computer, the DBGP menu item shows up under Plugins.
          4. I configured the debuger with menu item Plugins -> DBGp -> Config... as: "Remote Server IP" (127.0.0.1), "IDE KEY" (Blank), "Remote Path" (D:\www\ourcommunity.dev\public_html\supplier), "Local Path" (D:\www\ourcommunity.dev\public_html\supplier), where the Remote path and local path points to the directory I store my development php files.
          5. I created a 6 line php file named: debugTest.php in Notepad++. I loaded it up in firefox with http://localhost/supplier/debugTest.php. It works fine.
          6. Click on menu Plugins -> DBGP -> Debuger, it opens DBGp debuger panel at the bottom of the Notepad++. I put my cursor at one line of PHP and click "Add Break Point" icon to put a break point on that line.
          7. Click on menu Run -> Launch in Firefox. Firefox just loads the program in original text as  file:///D:/www/ourcommunity.dev/public_html/supplier/debugTest.php.

          What did I do wrong?

           
          • Nobody/Anonymous

            php_xdebug.dll is NOT a notepad++ plugin! It's a PHP module!
            Read installation manual at http://xdebug.org/docs/install

             
            • Nobody/Anonymous

              I made a mistake on installing Xdebug. Now I put the dll under my php extension directory and put the zend_extension_ts="C:/WebServer/Apache2/modules/php/ext/php_xdebug-2.0.0-5.1.6.dll" in my php.ini. Now the xdebug section shows up in my phpinfo page with the following lines:
              xdebug support    enabled
              Version     2.0.0

              Supported protocols    Revision
              DBGp - Common DeBuGger Protocol     $Revision: 1.125 $

              However, when I used Notepad++ menu: Plugins -> DBGp -> Step Into (F7), nothing happened. The program didn't stop at any breakpoints nor loading up firefox.

              Then I loaded the test file into firefox with http://localhost/supplier/debugTest.php. I clicked menu: Plugins -> DBGp -> Step Into (F7) still nothing happened.

              I am a programmer myself. Writing the program is half of the battle. Getting the users to use it successfully is the other half of the battle. I was very surprised to see I couldn't find many information in Google regarding php_dbg with Notepad++. If I could get it to work, I will document it and put it up on the web for others to see. Anyway, I am still confused.

              Thanks.

               
              • Damjan Cvetko

                Damjan Cvetko - 2007-09-25

                Hi again...

                I bet you found little to nothing about "php_dbg and Notepad++". First reason is because you should be Googling "XDebug and Notepad++" or "DBGP and Notepad++".  php_dbg is a different product. However you would still find little to nothing about it (mainly because I did not Blog yet about it or similar... If somebody else did, I don't know yet).

                Anyway, you are almost winning the battle...
                I'll explain a few fundamentals here.
                In classic debugging you have a running process and a debugging process that is attached to it. It's usual that the debugging IDE has a method to start the process it wants to debug.
                Debugging PHP that is running in a web server is quite a different story.
                First, it is not a running process, but more of start and finish as fast as possible. The only way to start this process is to request a page from the web server. Notepad++ has no way to start this process, because it has no integrated web browser. You as the developer need to start this process with a browser...
                I confess, the menu items of the plugin are somewhat confusing. I intend to implement some stuff in the next release that will help guide the user a bit more.

                Anyway. Try this checklis:

                1. Install DBGP plugin in notepad++ (I looks like you have this down)
                2. Configure DBGP plugin (The configuration looks ok)
                3. Install XDEBUG php plugin (looks ok, from your last post)
                4. Configure XDEBUG. You did not post any configuration, but take this as an example:
                xdebug.remote_enable=On
                xdebug.remote_host=127.0.0.1
                5. Restart all needed services (Well, just apache)
                6. Start Notepad++ and open the debugger (Plugins/DBGp/Debugger   The debugger is not working prior this step!!)
                7. Now open your browser and your page like this:
                http://localhost/supplier/debugTest.php?XDEBUG_SESSION=test

                If all goes well, Notead++ should flash and the buttons for stepping through code should get enabled. Press "Step Into" to get to the first line of code.

                I strongly recommend you read this page: http://www.xdebug.org/docs/remote

                Best regards...
                -Zobo

                 
                • Nobody/Anonymous

                  Zobo, you hit the nail at the head with your last post - I didn't set up the Xdebug in the php.ini file and I didn't add the ?XDEBUG_SESSION=test to the end of my test file. I used MS Visual Studio and this PHP debug is new to me. With your help, I finally get the xdebug to work with Notepad++. Thanks very much.

                  Now the code stops at the break points. And I can step into or step over the code. How can I exam the value of a variable at the break point?

                  Thanks. 

                   
                  • Damjan Cvetko

                    Damjan Cvetko - 2007-09-26

                    Just a quick answer how to inspect variables.

                    1. Go to config and enable "refresh local" an "refresh global". Two windows down left will be much help to you.
                    2. Select a variable with your cursor and press Ctrl+F7 (Evaluate) and a dialog will pop up. You can play around with that.

                    Next release will have some real goodies like 'eval on mouse over' and 'show changed variables in red' (maybe even watches). Like you are used to from VS (I use that too from time to time).

                    I'll write more when I get to work and have more time...

                    One quick note about colliding keyboard shortcuts (F9), check out the README.txt that comes with the plugin.

                    Re,
                    -Zobo

                     
                    • Nobody/Anonymous

                      Zobo, thanks for your help. Now I can use Notepad++ to debug my php code.

                      Since I went through so much trouble to set my plug in up, I created a wiki page to document the process. I hope other people can use it to setup their DBGp plug in. Here is the link to the page:

                      http://www.ourwikicommunity.com/wiki/How_to_Setup_BDGp_debugger_in_Notepad%2B%2B_to_Debug_PHP

                      Thanks again for your help.

                       
                      • Damjan Cvetko

                        Damjan Cvetko - 2007-09-26

                        Hi again... (I wish you had a name, so I can give you credit)

                        Sorry for not getting back to you earlier, it was a hectic day.
                        I love the tutorial you did. I'm definitely including this link in the next release.

                        I hope I can release this or next week.

                        Best regards, and do write if you have any other problems or suggestions for the plugin..

                        -Zobo

                         
              • Nobody/Anonymous

                Zobo. Thanks for your help. I created an installation document base on what I learned from you. Here is the link to my article. Please make change as you see fit.

                http://www.ourwikicommunity.com/wiki/How_to_Setup_BDGp_debugger_in_Notepad%2B%2B_to_Debug_PHP

                 
MongoDB Logo MongoDB