6

I always seem to have trouble configuring NetBeans with Xdebug on a new machine.

Is there a free Windows or cross-platform PHP IDE where debugging just works "out of the box"?

Frankly, I do not care about any of the editting features of the IDE, such as code completion, formatting, refactoring, etc.

All that interests me is debugging:

  • setting breakpoints
  • examining variables
  • watches
  • just the usual debugger stuff - working, with little or no configuration on my part, with a strong preference for none.

As such, I would expect the installation of the IDE to install and configure the debugger at the same time.

0

3 Answers 3

5

It is very easy and almost no work to set up XDebug with WAMPServer and SublimeText.

Just install WAMPServer, Select PHP/Apache extensions as desired. To enable XDebug for easy use: start WAMPServer, left click taskbar icon, select php->php settings and enable (XDebug): Remote Debug. (Free)

Install SublimeText. SublimeText is cross-platform (Windows, Linux, and OSX) and has a free unlimited functionality trial. Then install the SublimeTextXDebug plugin. The plugin itself is free and open source. Installation is quite simple - just run installer for SublimeText, open SublimeText and install Package Control, then in Sublime Text type ctrl-shift-p and select Package Control:Install Packages then select SublimeTextXDebug.

Then comes the only setup that is extra for XDebug usage - ie you still have to do all your normal setup of virtualhosts/host file etc however you would normally do it.

Open your root directory in Sublime and select Project->Save Project As and then edit your project file to include this: (extra settings can be added as well but they won't conflict)

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ],
    "settings": {
        "xdebug": {
             "url": "http://www.mytestingsite.example",
        }
    }
}

Of course setting the url to be the correct url for your testing.

Breakpoints can then be set by right click->XDebug-> menu.

To run the debugger just select Tools->XDebug->option you want (I suggest the Start Debugging (Launch Browser) option)... then debug away and details will be displayed in the XDebug panels that opened in SublimeEdit when you started debugging.

2

If you want a good tool, then you've to invest in it. Therefore you may try PhpED from NuSphere with integrated PHP debugger which is not completely free, but you can try the trial version. It has DBG Wizard Script which helps you to configure the debugger in very easy and convenient way. Unfortunately it's not cross-platform. I've used it successfully until I've migrated to Mac platforms.

Now I'm using NetBeans for PHP debugging (but very rarely) as most of the time I'm just editing XDebug logs manually using vim.

So if you want to have free cross-platform IDE for PHP debugging, my answer is: Vim. Once you activate xdebug.auto_trace in your PHP configuration, you can always debug specific functions/part of your code by xdebug_start_trace()/xdebug_stop_trace() instead of debugging everything. When you activate collect_vars and show_local_vars, you'll see all the variables and the whole workflow, so sometimes it's more beneficial than tracing your code step-by-step from IDE.

1
  • 1
    +1 even though it's not free, just because JetBrains make the best IDEs that I know of. A pity that there is no community edition, as with PyCharm. There are are free licences for students, classrooms and for OpenSource development. At $99 for a personal license, I would probably stick with NetBeans. I am also considering a move from PHP to NodeJS, which will mean another IDE hunt :-)
    – Mawg
    Commented May 13, 2015 at 12:53
1

Have a look at the Eclipse IDE. The platform has plugins for just about any language (including PHP) and it's free

https://eclipse.org/ide/

Here is a link to the PHP IDE plugin:

https://eclipse.org/pdt/

Without repeating too much what you can find at this link, in short, the Eclipse IDE for PHP plugin has:

  • Syntax Highlighting
  • Content Assist
  • Code Formatter
  • Refactoring
  • Code Templates
  • Debugger
  • Easy to Install and Extend
4
  • As it happens, I am using Eclipse - now; but I accepted and used a good answer at the time . I will upvote you because you are new and because this answers will help others - slightly. For future answers, you you need to give more detail & explain how your answer addresses the question. In this case, you don't even mention debugging, or how to configure it. And debug was the entire point of the question. Please don't take this as a a complain; I just want to help you to help others. Welcome aboard !
    – Mawg
    Commented Jan 27, 2017 at 12:13
  • No problem. Welcome aboard. I look forward to seeing more answers from you. Feel free to add practise by adding more to this one; it can help others who read it in future.
    – Mawg
    Commented Jan 27, 2017 at 14:23
  • 1
    @Mawg - I updated my answer and gave more detail, as you recommended. Again, thank you.
    – tale852150
    Commented Feb 1, 2017 at 15:39
  • Just keep answering like that and you will be avaluable asset around here :-)
    – Mawg
    Commented Feb 1, 2017 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.