XDebug doesn’t show local variables in Komodo, NetBeans or Eclipse PDT

Lovely surprise that came sometime after upgrading Lucid Lynx(and thus to PHP 5.3.2) – Xdebug doesn’t show local variables. Fortunately that’s a known issue that is fixed in Xdebug 2.1.0RC, but since it’s not released, it is not yet in Ubuntu’s repository. This should be pretty easy to fix though :) let’s try this:

sudo apt-get install php5-dev php-pear

That’ll get us ready for manual xdebug building. Then we need to get the sources. Gotta tell you, Xdebug guys are pretty awesome – they put together this nice little tool that helps you find and build the right version: http://xdebug.org/find-binary.php

It requires output of phpinfo() or in ‘php -i’ command and based on that gives you set by step instructions.

For standard Lucid Lynx install it boils down to the following commands:

wget http://xdebug.org/files/xdebug-2.1.0RC1.tgz
tar -xvzf xdebug-2.1.0RC1.tgz
cd xdebug-2.1.0RC1
sudo cp modules/xdebug.so /usr/lib/php5/20090626
sudo /etc/init.d/apache2 restart

Before restarting the server though(last command) you may want to double check the the following line exists in either /etc/php5/apache2/php.ini or in /etc/php5/apache2/conf.d/xdebug.ini

zend_extension = /usr/lib/php5/20090626/xdebug.so

13 thoughts on “XDebug doesn’t show local variables in Komodo, NetBeans or Eclipse PDT

  1. Thanks for the info about xdebug problems with Ubuntu Lucid. I just upgraded yesterday from Karmic to Lucid, and suddenly Netbeans is not displaying local variables for my PHP projects.

    I’m certainly going to try your suggestion and build xdebug.

  2. Pingback: local variables don’t display in Netbeans with php 5.3.2 and xdebug 2.0.5 « PHP Hints

  3. WOW! Thank you!

    At this stage in my development career, 90% of what I use an IDE for is in-object observation. Without Xdebug working, I was fearing the long road of var_dump-and-die()… EEK!

    This page saved my day. A thousand thank yous!

  4. Thanks, before reading this article i tried to change almost every configuration in php.ini/xdebug.
    Fortunately I currently work in windows and 2.1rc binaries were easy to download and worked fine.

  5. Pingback: How to setup local PHP debugging with PHPStorm and Xdebug |Antarctic Nest of Icephoenix

  6. guys,
    if you can’t see your variables, then you might want to use a watch. Simply click the diamond ‘watch’ icon in the variables tab and type the name of your variable (like $myvar). Then netbeans will read it.

    However, having to add several ‘watch expression’ is tedious

  7. For some reason I never had ‘watch’ working well with XDebug… it either doesn’t do anything or it breaks it all. The only exception was debugging with Xdebug inside Vim(via vim-xdebug plugin).

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>