views:

501

answers:

10

I am coming from a C++ background and am used to testing code by setting breakpoints, viewing variables in the debugger etc.

I am now doing web development (using the symfony framework). what I really miss is not being able to set a breakpoint when a particular action is performed (e.g. a url clicked etc). Is there a FREE (GPL or other license) PHP IDE that can allow me to set breakpoints etc as described above?

+13  A: 

NetBeans for PHP uses xdebug, in which you can set breakpoints among other functionality. It's the best IDE for PHP I've tried (and I've tried alot of IDEs).

From http://www.netbeans.org/features/php/index.html

Debug PHP code using Xdebug: You can inspect local variables, set watches, set breakpoints, and evaluate code live. Navigate to declarations, types and files using Go To shortcuts and hypertext links. Use a global PHP include path for all projects or customize it per project.

The NetBeans IDE for PHP also offers command-line debugging: The PHP program output appears in a command line display in the IDE itself and you can inspect the generated HTML without having to switch to a browser.

You can debug scripts and web pages, either locally or remotely. The NetBeans PHP debugger integration allows you to map server paths to local paths to enable remote debugging.

I've looked up Eclipse PDT as well, and it uses Zend Debugger (or xdebug, but ZD seems to be the default debugger). I have never used it (I have used Aptana Studio, a Eclipse sub project, didn't like it) but Eclipse is a solid IDE and used widely. I have never had the need for trading away NetBeans for Eclipse thou. Anyway - IBM wrote a white paper on debugging PHP in Eclipse PDT using Zend Debugger. Happy reading. ;)

Björn
UEStudio also has XDebug integration too
nickf
I use NetBeans for PHP/Zend Framework development, and I have found it more agreeable than Eclipse PDT ... Eclipse PDT requires a lot of configuration to get it to work how I want it.
Eugene M
Think I'll be going with Netbeans (I have already installed it). From online research I have seen. Eclipse is "big and slow", difficult to configure (though with a larger usebase), but Netbeans allows you to hit the ground running even though may be slight less feature rich as Eclipse. So Netbeans it is for me - I dont want a steep learning curve on just configuration let alone using the IDE etc ...
skyeagle
+2  A: 

I can suggest you Aptana (www.aptana.com). You can set breakpoints, jump to another breakpoint in debug mode. You can use Firefox addon of Aptana.

Erkan BALABAN
I like the idea of a firefox add-in - are you sure about this?. AFAIK, the browser is served the output of the server side PHP script - I am not sure how you can debug the PHP script in a browser (it as an aside, it also does raise some security concerns if even it is possible - am I missing something?)
skyeagle
I want to add someting my Aptana suggestion. They released 2.0 version recently. But they announced that they won't release any version of their PHP plugin. They say that they will use Eclipse as a plugin for PHP development. If you want an IDE for PHP development you can use Aptana with Eclipse as a plug in or you can download Eclipse PDT as a stand alone program. I am using Eclipse PDT for PHP development.
Erkan BALABAN
A: 

First I agree: Netbeans is the best current PHP IDE

As for debugging you might follow a different approach - as symfony tends to jump between requests

  • It will be quite difficult to follow it with xdebug
  • Also there is a high chance that you'll run your code on a remote server

We found FirePHP (FireBug extension) very useful for these cases.

There is a great symfony plugin implementation for it: sfFirePHPPlugin

http://www.symfony-project.org/plugins/sfFirePHPPlugin

Be sure to create code templates for it in Netbeans! ;)

$firephp = sfFirePHP::getInstance(true);
$firephp->fb(${variable}, '${caption}');
Attila Koteles
interesting, will take a look at this (Firebug rulez !!)
skyeagle
+1  A: 

As the other answerers have mentioned, there are a number of PHP-savvy IDEs which integrate with XDebug. I thought I'd just add that these are PHP debuggers, and since PHP is a server-side language, it's not going to help you debug client-side actions, such as clicking a link.

If there's code you want to be pausing/viewing when the client performs actions, then your best bet is a Javascript debugger. Mozilla has one called Venkman (named after Bill Murray's character in Ghostbusters -- awesome!), but I've always found Firebug to be much more useful. Using it is a doddle:

<a href="blah.html" id="myLink">Clicky</a>

document.getElementById('myLink').onclick = function() {
    debugger; // this sets a breakpoint, effectively
};

You can also browse your JS source with Firebug and add breakpoints to code from there.

nickf
Had to Google "doddle". "child's play, cinch, duck soup, piece of cake, pushover, breeze, walkover, picnic, snap"
ChuckO
+1  A: 

I will have to say php NuSphere PhpEd is the one I like most. It has all the features of good editor. And it allows debugging (setting break points too). You will have to download and add dbgwizard to the local server. I am not sure if it can do debugging on remote server.

Krishna Kant Sharma
A: 

I'm going to have to second Aptana. If you've ever used DreamWeaver it's a lot like that, with all the useless garbage stripped out. Also has built in support for repositories, ajax, debug mode and works on any OS.

Psilokan
A: 

PhpEd is awesome. Not free though

Dave
A: 

I recommend you netbeans its free. it is available for all platforms, and mostly it is good for editing php, jsp, java, css, html, ...

believe me, i'm using it for php development and its the best suited ide i can find...

JSixface
A: 

I use Eclipse for php + symfony, Eclipse has a lot of plugins that make my life easier, when i need to debug i use logs, echo followed by die() so i can see what is going, and firebug on firefox.

Luciano
A: 

Yes, i think you are looking for phpDesigner:

  1. Feature loaded but still fast and intuitive to use and learn!

  2. Full-blown PHP, HTML, CSS and JavaScript editor!

  3. Advanced code tip and code completion with OOP!

  4. Debug and profile your PHP scripts with Xdebug!

  5. Work with all PHP- and popular JavaScript frameworks!

  6. Work with files over FTP/SFTP and TortoiseSVN support!

Debug and profile PHP scripts with Xdebug

Analyze your code step by step with breakpoints, watches and evaluations. Find bottlenecks in your code and speed up the slow parts in your code with the profiler.

phpDesigner 7 comes with full support for full support for PHP 5.3 and configured to work with Xdebug.

* Debug with breakpoints
* Call stack
* Context variables
* Watches
* Evaluate injection (local, global)
* Debug errors
* Syntax check for PHP
* Profiler

alt text

Sarfraz