NetBeans, Codeigniter and debugging with XDebug in MAMP

I just started testing Netbeans and after I got the code indention work as it should (took about 3 hours and still couple thing’s I don’t like) and got the autocomplete working on my own models, I found this awesome tutorial by Leonard Teo.

I was trying to make supershort example how to enable this on MAMP but looks like it wasn’t that easy job icon wink NetBeans, Codeigniter and debugging with XDebug in MAMP Here’s couple simple steps to enable XDebug on MAMP:

PHP

  1. Open php.ini (Applications:MAMP:conf:apache:YOUR PHP VERSION, example php5.2)
  2.  Uncomment line: zend_extension=/usr/lib/php5/20090626/xdebug.so
  3. Add next 4 lines after the previous line:
    xdebug.remote_enable=on
    xdebug.remote_handler=dbgp
    xdebug.remote_host= localhost
    xdebug.remote_port=9000
  4. Restart apache

NetBeans

  1. Open Project Properties (right click your project)
  2. Select Advanced on “Run Configuration
  3. Set “Do Not Open Web Browser“ and click OK.

Chrome or Firefox

  1. Install Xdebug helper
  2. Open Xdebug helper options and add there your local development domain.

I’ve only tested this on Chrome, so now you should see Xdebug helper icon on address bar on your local development domain. By clicking it you can enable the debugger.

How to debug

  1. Add break point on the line you want to debug in NetBeans
  2. Start debugging on NetBeans (Debug -> Debug Main Project)
  3. Go to the url you want to debug with your browser
  4. Go back to NetBeans and click Debug -> Continue untill you find your Break point etc…
This entry was posted in Codeigniter and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>