Xdebug on Ubuntu for WordPress

Turns out enabling Xdebug on Ubuntu for Eclipse PDT is easier than doing the same on Windows.

The short version is installing the module as per this tutorial – http://ubuntuforums.org/showthread.php?t=525257
[bash]
sudo apt-get install php5-dev php-pear
sudo pecl install xdebug

sudo updatedb
locate xdebug (this one finds the xdebug path)
sudo gedit /etc/php/apache2/php.ini
[/bash]

Adding this line (/w the path):
[bash]
zend_extension=”/usr/lib/php5/20060613/xdebug.so”
sudo /etc/init.d/apache2 restart (or sudo apache2ctl restart)
[/bash]
This install the xDebug and enables it.

Then we need to add a few more lines of code in /etc/php5/apache2/php.ini (as in here):

http://holisticsecurity.wordpress.com/2011/07/04/php-xdebug-xampp-win32/
[bash]
xdebug.auto_trace = 0
xdebug.collect_includes = 1
xdebug.collect_params = 0
xdebug.collect_return = 0
xdebug.collect_vars = “Off”
xdebug.default_enable = “On”
xdebug.dump.COOKIE = “”
xdebug.dump.FILES = “”
xdebug.dump.GET = “”
xdebug.dump.POST = “”
xdebug.dump.REQUEST = “”
xdebug.dump.SERVER = “”
xdebug.dump.SESSION = “”
xdebug.dump_globals = 1
xdebug.dump_once = 1
xdebug.dump_undefined = 0
xdebug.extended_info = 1
xdebug.file_link_format = “”
xdebug.idekey = “”
xdebug.manual_url = “http://www.php.net”
xdebug.max_nesting_level = 100
xdebug.overload_var_dump = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = “/tmp”
xdebug.profiler_output_name = “xdebug_profile.%R::%u”

; xdebug.remote_autostart
; Type: boolean, Default value: 0
; Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Remote
; Debugging). When this setting is set to ‘On’ Xdebug will always attempt to start a remote debugging
; session and try to connect to a client, even if the GET/POST/COOKIE variable was not present.
xdebug.remote_autostart = 1

; xdebug.remote_enable
; Type: boolean, Default value: 0
; This switch controls whether Xdebug should try to contact a debug client which is listening on the
; host and port as set with the settings xdebug.remote_host and xdebug.remote_port. If a connection
; can not be established the script will just continue as if this setting was Off.
xdebug.remote_enable = 1

xdebug.remote_handler = “dbgp”
xdebug.remote_host = “localhost”
xdebug.remote_log = “none”
xdebug.remote_mode = “req”
xdebug.remote_port = 9000
xdebug.show_exception_trace = 0
xdebug.show_local_vars = 0
xdebug.show_mem_delta = 0
xdebug.trace_format = 0
xdebug.trace_options = 0
xdebug.trace_output_dir = “/tmp”
xdebug.trace_output_name = “trace.%c”
xdebug.var_display_max_children = 128
xdebug.var_display_max_data = 512
xdebug.var_display_max_depth = 3
[/bash]
Then create an Eclipse project, click the Debug Configurations

Create a website configuration, select Xdebug, set the paths for the index.php and configure project names; set the web server as well so that this could run smoothly.

Run the project in Debug perspective.

Edit: A great resource for step-by-step setup with screenshots by Wptuts+ – here.

2 thoughts on “Xdebug on Ubuntu for WordPress”

  1. WordPress Developer says: March 3, 2012 at 10:41 pm

    Wow! I am going to apply this on my Ubuntu. Thanks guys

Leave a Reply

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