ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

IDE's with debuggers that actually work with CodeIgniter

September 04, 2009 10:39pm

Subscribe [8]
  • #1 / Sep 04, 2009 10:39pm

    BrianDHall

    760 posts

    I was playing around with some IDE’s today and took a reccomendation to try Aptana. Debugging doesn’t seem to work with CI the way I would want it - which is set a breakpoint in, say, my view or controller, then click ‘debug’ and it halts right there then allowing me to step into/out of/over the code one line of a time, and giving me access to variable values, various scopes that exist at that point in time, objects and their values, etc.

    With PhpED this works fine - I can’t use breakpoints, I have to type in DebugBreak() and then open the page I want to debug in a localhost browser window…but frankly this isn’t a big deal as far as work-arounds go. It works, and I’m good with that.

    I wanted to see about a debugger with a little better intellisense and support for SVN/Git source control (PhpED oddly only supports CVS internally, not that using an outside management program would be so horrible - which is what I’ll probably end up doing), and any other nice extras would be cool but that’s really what I was after.

    I tried Aptana, which fits the bill…but debugging doesn’t work and in my google searches everyone seems to just say “oh yeah, I don’t use that…” and in the Aptana forums it shows up on a lot of wish lists that they want for support for frameworks like CodeIgniter and Cake.

    So, what options are they with fully working integrated debugging and SVN/Git source control, and intellisense that works with frameworks like CodeIgniter? Does netbeans or the Zend IDE do all this?

    EDIT: Oh, PhpED has inline syntax warning, so if you forget a ; or mismatch a { or ( or ’ or ” it lets you know right away, which has been so damn useful that I refuse to ever do without it again.

  • #2 / Sep 07, 2009 6:00am

    n0xie

    1381 posts

    So, what options are they with fully working integrated debugging and SVN/Git source control, and intellisense that works with frameworks like CodeIgniter? Does netbeans or the Zend IDE do all this?

    I’ve been using Netbeans and it does all that. For Xdebug support (which is a bit tricky to setup it) take a look here:
    http://ellislab.com/forums/viewthread/105866/

    It also does inline syntax warning, has SVN support integrated, does CodeIgniter intellisense, CodeIgniter code highlighting, CodeIgniter autocompletions, has templates so you don’t have to build ‘every Controller, method and view’ by hand but just let Netbeans create them for you and programmable shortkeys which I use a lot.

    This means that when I type:

    db
    md
    vw

    and press ‘TAB’ it changes this to:

    $this->db->
    $this->load->model(_)
    $this->load->view(_);

    Like with every IDE it takes getting used to and the default ‘skin’ and ‘font’ and ‘behaviours’ could be better (something with spaces and tabs which you have to fix manually) but all in all I’m quite pleased with it sofar. It is a full stack IDE so it won’t be fast (unless your hardware is fast) but it should be ‘lighter’ than most other full stack IDE’s.

  • #3 / Sep 07, 2009 8:34am

    elambiguo

    22 posts

    I use two… one in my work (WeBuilder) and one, minus, in my house, but very impressioned with this (phpDesigner).......

    P.S. Sorry for my english….

  • #4 / Sep 08, 2009 9:55am

    attos

    58 posts

    You can debug CI code with NetBeans. There is some configuration changes.
    Please refer to this post:
    http://ellislab.com/forums/viewreply/630554/

  • #5 / Sep 08, 2009 2:14pm

    BrianDHall

    760 posts

    Interesting, I might have to give NetBeans a try in my spare time. I’m blessed with fast hardware (the first time I’ve had fast hardware in like…uh…10 years) so that’s not such an issue.

    Does it have search/replace in files and code collapsing down to methods/functions too?

    Any particular other gotchyas in setting it up to work with codeigniter that you found, or is just getting debugging ‘just so’ the only real obstacle?

  • #6 / Sep 08, 2009 2:36pm

    attos

    58 posts

    You don’t really need ‘fast hardware’. I use NB in a variety of HW and OS. It even runs OK on an EEE-PC 701 (well, 2GB of memory).

    NB provides code folding, searc in projects (or files) and there was a post on how to enable CI autocomplete with netbeans:
    http://ellislab.com/forums/viewthread/128248/

    No other glitches or gotchas. It just runs like a charm.

  • #7 / Sep 09, 2009 9:37am

    attos

    58 posts

    I was thinking about the ‘gotchas’. As I said before there are none, but some requirements and additional configuration are needed:

    1. the xdebug extension for your PHP distribution (YMMV)
    2. the php.ini needs to be modified to load the extension
    3. NB needs know where the PHP interpreter is located

    I can help you if you run into problems.

  • #8 / Sep 09, 2009 11:38am

    BrianDHall

    760 posts

    I’ve decided to try Netbeans, spent about an hour with it at home and only had one problem the whole day.

    I did have a problem getting xdebug setup, but I didn’t spend enough time on it to see what was up. Thanks for the offer attos, I’ll take you up on it if I can’t sort it out.

    I was pleasantly surprised how non-crappy it was…LOL. I remember using sun’s ide for java years ago, and what a difference a few years has made. That thing took unbelievable amounts of time to load (run it and take a break for the next 5 minutes to get it to start), was kludgey and buggy, it made me wonder why anyone would build a complicated application in Java at all.

    I love seeing progress. I also noticed a plugin for git as well as native support for SVN and others, and I like the idea of the code expanding option. I’m going to try to spare some time to play around with it, but the deal-breaker is going to be xdebug - debugging has to work really well for me to consider switching.

  • #9 / Sep 09, 2009 5:22pm

    attos

    58 posts

    Ok, lets do it.

    You need to know where the xdebug extension is located. The dev environment I’m using is WinXP/XAMPP. In the php.ini file I have the following lines:

    [xdebug]
    zend_extension_ts=\xampp\php\ext\php_xdebug.dll
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_port=9000
    cgi.force_redirect = 0

    You may need to restart the web server for this changes to take effect.

    In NB, from the main menu select Tools | Options and under the PHP tab (Click on the PHP icon) set the path and file name of the PHP interpreter. In my case I have:
    \xampp\php\php.exe
    Also check that the debugging port is 9000

    Also configure you CI app as mentioned in one of the above posts.

    This should do the trick.

  • #10 / Sep 17, 2009 10:12pm

    BrianDHall

    760 posts

    I finally got around to trying debugging in NetBeans attos - thanks for your help, it works great! One thing that bit me was I had downloaded the wrong version of XDebug as I didn’t get the significance of the version names - darn php 5.3 is trouble all the way around (seeing as how I don’t have it) :D

    It seems to do everything that debugging did in Phped, except I can actually use real breakpoints and not have to type DebugBreak() in anytime I want a breakpoint.

    I’ma liking - thanks for the help! Now to try out that cool autocomplete goodness and version control.

  • #11 / Sep 18, 2009 12:27am

    pmoroom

    55 posts

    x2 for netbeans.  I like aptana as well.

  • #12 / Sep 18, 2009 12:35am

    BrianDHall

    760 posts

    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.

  • #13 / Sep 20, 2009 5:13pm

    Myles Wakeham

    118 posts

    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:

    http://blogs.sun.com/netbeansphp/entry/howto_check_xdebug_installation

    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):

    [XDebug]
    zend_extension_ts = "C:\wamp\bin\php\php5.2.9-2\ext\php_xdebug.dll"
    xdebug.remote_enable=1
    xdebug.remote_mode=req
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    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.

    Myles

  • #14 / Sep 20, 2009 6:40pm

    Myles Wakeham

    118 posts

    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.

    Myles

  • #15 / Sep 21, 2009 9:40am

    BrianDHall

    760 posts

    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.

    -Brian

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases