IDE's with debuggers that actually work with CodeIgniter

x2 for netbeans. I like aptana as well.

Anyone played with NetBeans git plugin, nbgit? I can't figure out how to create a branch with it - I can do a regular commit and checkout, but don't see how to switch amongst branches and such.

[eluser]Myles Wakeham[/eluser]
I'm encouraged to hear that you guys have been able to get NetBeans and xDebug working together. But I cannot share the joy with this, even after 2 days of trying to get it going...

Maybe someone with better luck (or the scars of battle and prize of winning) could share some ideas on what is going wrong, because I'm out of ideas.

I have a Windows XP SP3 dev laptop machine, with WAMP (Apache 2, PHP 5.2.9) installed with CI. I use Firefox 3.5.x for my testing.

I have a large enterprise app that I'm trying to debug. I'm down to the last 5% of development work on this app, which has taken me about 12 months and although I've been able to live without trace level debugging, its now killing me not having it. What I need to be able to do is to step trace through functions, models, controllers, etc. within CI by setting breakpoints and letting the code execute until the breakpoint is hit, then fire back to the IDE and let me visualize what is executing, variable content, etc. This is considered a mandatory standard in any development environment I've worked with in the past, and not having this is crippling my ability to deliver my clients their solutions. So I did my research, checked out videos, etc. and it appears to be available. Now its just a matter of getting it working.

I've been using Zend Studio for Eclipse. Unfortunately my experience with the Zend debugger was fine for a simple 1 dimensional script. But not a full-on MVC app like a CI app, so it didn't work for me. I downloaded and installed NetBeans 6.7.1 on Friday and watched a great video on their website about debugging and realized this would be the solution for me. Sure, Netbeans is a pain to start up. Everyone seems to think that is because its written in Java, but actually that's not the problem. Its the time that its taking to 'scan projects' that is killing me, but as we are using SVN with it I'm thinking that its all got to do with SVN version handling but I can't be sure. Anyway I can live with the startup time if I could just get this debugger working...

So I setup all the xDebug stuff in Apache. There's a clump of code on Sun's website showing how to test if xDebug is setup correctly, and I ran that successfully. xDebug is correctly showing in phpinfo and the test php code. I used the test code found here:

xDebug is definitely responding correctly on port 9000 as the test proves.

But whenever I start NetBeans and try and debug my code, it just sits there with the message 'Waiting for connection' and never responds back. If I eventually stop the debugger, I get back an information dialog with 'There is no connection from xdebug detected in xx seconds...' and telling me a bunch of settings I need to add to my php.ini file. Well they are all there and its working fine outside of Netbeans.

I scanned my computer for other php.ini files that maybe Netbeans is detecting and changed them all to a different filename to force Netbeans to work with the correct one. No difference. This is what is set in my php.ini file, which I believe is correct for this to work (and as its working outside of Netbeans, I can only assume Netbeans is the problem):

zend_extension_ts = "C:\wamp\bin\php\php5.2.9-2\ext\php_xdebug.dll"
cgi.force_redirect = 0

I checked the version of php_xdebug.dll and its correct for php 5.2.9 and since its working outside of NetBeans, its not causing Apache to crash or anything like that.

The only other thing I can think of that might be a problem here is how NetBeans Project Properties are set for my code. Since CI projects are kinda strange in their URLs and Netbeans seems to want to support a page and then GET arguments afterwards, I setup a simple PHP test script to see if it would even just call that, and again no luck - its just waiting at the 'Waiting for connection' again. If I execute the page directly from Netbeans, it works fine with Firefox. Just a problem with the debugger.

I'd really appreciate any advice on how to get past this. Its now really taking a chunk out of my progress on this system and I have to deliver very soon, so I need this up and running pronto.

Thanks in advance for any help or advice.


[eluser]Myles Wakeham[/eluser]
OK, quick update. I got it working.

Here's the deal....

I could NOT get it to work with Netbeans 6.7.1. Any attempt with that version failed in being able to connect to port 9000 to hit xDebug. I found a few posts on the NetBeans forums about how to enable logging in NB and after doing that and analyzing the logs I could see that it was trying to connect to xDebug, but failing all the time. I then started up a small PHP script to get xDebug listening, and then did a port scan on my local computer for port 9000 using LANSpy and it immediately detected the incoming socket TCP port connect and responded back so I knew that xDebug was working ok.

I then decided to take a punt and checked some past posts about users who had gotten this to work. I noticed that they seemed to be using the NetBeans 6.5 release, so I found a download link to NB 6.5 RC2 and downloaded and installed it. Well golly gosh.... It worked perfect first time.

Yep, there is some sort of a bug with this in 6.7.1 from what I can tell. I can't seem to find any documentation as to why, but as soon as I rolled back a version or so, it all just started working.

I now have my CI code completely debuggable and its brilliant. Exactly what was promised is now being delivered. This is a new day, and I'm really full of hope of actually getting this project finally completed now.

Hope this info helps some other poor soul out at a later time.


I'm glad you got everything working Myles. I'm glad the older version worked, I have a different system so can't speak to why it might be a problem.

I know now that you'll probably never want to be without a full debugger for PHP/CI. Its amazing what a little break or watch will can do to show you want went wrong - especially in CI, where $this is loaded with so much useful information on the DB, session, etc.


[eluser]Myles Wakeham[/eluser]
[quote author="BrianDHall" date="1253554831"]I'm glad you got everything working Myles. I'm glad the older version worked, I have a different system so can't speak to why it might be a problem.

I know now that you'll probably never want to be without a full debugger for PHP/CI. Its amazing what a little break or watch will can do to show you want went wrong - especially in CI, where $this is loaded with so much useful information on the DB, session, etc.

That is so true. Within 10 minutes of getting this running, and after taking a quick break from exhausting myself with it, I returned back to my project to the first bug to fix and found a flaw in the design that I would never have seen if it wasn't for trace level debugging. That, alone, would have taken me hours to find and fix so the payback was instant.

Having come from developing in languages where trace level debugging is assumed (I'm a Delphi & C++ developer before) I just took that for granted. I can never understand how a developer can be without those sorts of tools and expect to be productive. Its not that you need them - but without them you are working in the dark.

My concern right now for the PHP/CI/Open Source community like us is how we can compete in the enterprise world with other developers who use closed sourced tools (mainly the MS developers with Visual Studio). What I am seeing is that my biggest competition in the space that we work in are VB developers who have been given an IDE that they can literally check a box and convert their badly designed & coded GUI app into a badly designed web app. That is scary stuff. But they have an IDE that gives them all the capabilities to do this including debugging. And I have to produce systems at the same pace in order to compete in that space. My clients want what I do because they want all the freedom and choices of having open source solutions. But they expect me to be able to produce at the same pace as the other developers who can't give them the same freedom. I guess I want to be able to let them 'have their cake & eat it too' which I do see as a major competitive advantage for PHP/CI developers.

Anyway I just hope we can try and evangelize all other CI developers into using trace level debugging. It will produce better systems faster, which ultimately is the reason why we use CI in the first place.


Its very true, I make a point to try to encourage others to try the tools I was so resistant too myself.

I think the problem is that PHP is so easy to start with, one of its selling points is that you don't need all that crap. You can get started with Notepad, and upgrading to something like Notepad++ with code highlighting is nice - but not really necessary. Its just so easy to do things you can often start learning and working in PHP before you can even figure out how to install Microsoft tools!

Heck, I never did get ASP.NET installed on my work computer (I'm responsible for a site built in basic ASP). It was such a mess of updates and dependencies, I gave up and uninstalled it all and had to reinstall my development server because IIS installed even though I didn't want it.

However, this simplicity to start must gradually grow, and slowly but surely an IDE becomes a better and better value. When I start with PHP though, there was no such thing as frameworks or even an IDE for PHP, and I don't think XDebug even existed - or if it did no one spoke of it.

As you use a framework your power to be productive increases, but so does complexity. Without a tool to manage this increase in complexity you will lose a great deal of profit you could have gained from the switch-over to better ways of working.

I think knowledge is power here, as is sincerity and clarity in the value of spending a little time to get started with an IDE and debugger. Further, making it easier to get these programs up and running and XAMPP, etc, shipping with XDEBUG by default make things better and better.

You don't want to insist on using any given set of tools, as every tool has its own learning curve and I'd never have switched to CI if I was required to learn an IDE and install a debugger - but we must all strive to keep learning and teaching, and to not get too comfortable with the way we do things now and entirely miss whole new levels of improvements that are available to us.

[eluser]Myles Wakeham[/eluser]
Right on, brother! Smile

I've worked in development environments before that were complete 'RAD' tools designed at non-developers, that due to platform monopoly or lack of options, became the gold standard for development languages in their areas. I've inherited code from non-developers who eventually thought they were developers. Boy, were they wrong. Complexity in systems is like clothes in a closet. You never thought you'd fill up your closet, but given the space you will fill it up.

Developing a small website is one thing. Developing enterprise class applications for the cloud (as we do) that are designed to be 'GUI replacements' is an entirely different animal. This is the future growth area for CI/PHP developers, but we need tools to allow this to happen quickly and despite a lot of hard core PHP developers hanging onto Notepad or VI for sheer life, the fact is that they might be comfortable with rudimentary tools, but they won't be able to compete with a lesser developer but a better IDE toolset in the future. The IDEs are starting to get smarter (or at least are wanting to) so that anyone's Mom (and nothing against Moms here because many of us have programmers for mothers...) could develop a full featured web application. That's scary, but its been the goal of IDE builders for decades. MS seem to have gotten closer to that than anyone else, but you have to swallow the poison pill of IIS, MS SQL Server, Windoze Server, etc. to play in that camp. Bring the checkbook along with you and good luck.


[quote author="Myles Wakeham" date="1253559474"]
PHP developers hanging onto Notepad or VI for sheer life[/quote]
With all due respect but I wouldn't group the VI users in with the Notepad users...

Most VI users I know don't see the point in an IDE and they are usually right ;-)

[eluser]Myles Wakeham[/eluser]
[quote author="n0xie" date="1253564173"][quote author="Myles Wakeham" date="1253559474"]
PHP developers hanging onto Notepad or VI for sheer life[/quote]
With all due respect but I wouldn't group the VI users in with the Notepad users...

Yeh, you are probably right. I wrote some pretty big C code in the 1980s with VI & Make, so you have a point. But given the complexity requirements these days, I'd be scared to death to take on a project just with those tools now.

However the essence of my post is more that the 'sweet spot' is a good developer with good tools. Not a good developer with bad tools, or a bad developer with good tools. But hey - if you can create an application that rivals a big enterprise class GUI desktop app with VI in PHP/CI, all power to ya. Tell the world the secret, and I'm sure we'll all listen.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.