Skip to content

Instantly share code, notes, and snippets.

@garretttaco
Last active August 27, 2015 15:58
Show Gist options
  • Save garretttaco/4d54f3af5b11a8736c09 to your computer and use it in GitHub Desktop.
Save garretttaco/4d54f3af5b11a8736c09 to your computer and use it in GitHub Desktop.

###Step 1 make sure xdebug is installed and as a zend extension.

sudo apt-get install php5-dev && sudo apt-get install php-pear

sudo pecl install xdebug

sudo apachectl restart

make sure xdebug has an .ini file check if there is one for your whole system or multiple. ( force php and apache to use the same conf.d xdebug.ini file)

run php -i | grep xdebug

you need two key things to be set-up :

xdebug.idekey => netbeans => netbeans

and

xdebug.remote_host => 192.168.99.1 => 192.168.99.1 (try localhost if this doesn't work )

here is a default setup for a debian xdebug.ini file

path:

nano /usr/local/etc/php/conf.d/xdebug.ini

File contents:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey=netbeans
xdebug.remote_host=192.168.99.1

###Step 2

Make sure the Netbeans ide is setup as well. ######Netbeans Preferences go to NetBeans > Preferences > PHP > Debugging

make sure the session id is the same as the one we set up previously in xdebug.idekey => netbeans => netbeans so it should be netbeans;

######Project Properties right click the Project name under the project tab in the upper left corner. go to Properties > Run Configuration > Advanced

Make sure the Server Path and Project Path are the correct paths ( should be the same if using local dev setup or /var/www.html/... for Docker).

###XDEBUG CLI for xdebug cli use global environment variable

export XDEBUG_CONFIG="idekey=netbeans"

then run

echo $XDEBUG_CONFIG

and make sure it is set to netbeans as you expect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment