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
Here’s couple simple steps to enable XDebug on MAMP:
PHP
- Open php.ini (Applications:MAMP:conf:apache:YOUR PHP VERSION, example php5.2)
- Uncomment line: zend_extension=/usr/lib/php5/20090626/xdebug.so
- Add next 4 lines after the previous line:
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host= localhost
xdebug.remote_port=9000 - Restart apache
NetBeans
- Open Project Properties (right click your project)
- Select Advanced on “Run Configuration“
- Set “Do Not Open Web Browser“ and click OK.
Chrome or Firefox
- Install Xdebug helper
- 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
- Add break point on the line you want to debug in NetBeans
- Start debugging on NetBeans (Debug -> Debug Main Project)
- Go to the url you want to debug with your browser
- Go back to NetBeans and click Debug -> Continue untill you find your Break point etc…
