Installing Xdebug
1. Install Xdebug for php
sudo apt-get install php5-xdebug
2. Setup xdebug.ini for ubuntu
vim /etc/php5/fpm/conf.d/20-xdebug.ini
Add following lines:
xdebug.profiler_output_dir=/tmp xdebug.profiler_output_name=cachegrind.out.%p xdebug.profiler_enable_trigger=1 xdebug.profiler_enable=0 xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 xdebug.remote_port=9001 xdebug.remote_handler=dbgp xdebug.remote_autostart=0
3. Restart php5-fpm
sudo service php5-fpm restart
Configuring Netbeans:
- Go to Tools > Options > PHP > Debugging
- Set
Debugging Port : 9001
- Start Debugging your project by Ctrl+F5 or file by Ctrl+Shift+F5
For WordPress Plugin/Theme:
- Go to Project Properties > Run Configuration. Set Project URL.
- Go to Advanced Options.
- Map your local project path (source code directory) with the server path (plugin/theme directory on your server).
- Start Debugging your theme/plugin.
For more details, check out the Xdebug Documentation.