Contents At Glance
- You are using a linux distro, in my instance I’m using Linux Mint, but this is applicable to any deb-based linux for example Ubuntu or Debian
- You’ve installed your LAMP stack ‘raw-ly‘
- This issue reported here is NOT applicable to a XAMPP installation, since in xampp the ‘normal’ way of configuring xdebug works fine
Overview Of The Issue
Today I did a fresh ‘raw’ install of my LAMP stack and tried to configure Xdebug to work with Netbeans. Surprisingly, when I viewed phpinfo(), I cannot find the xdebug to be loaded. I banged my head on the wall for around 2hrs + googling, but could at all figure out why xdebug was not being loaded. NO, I assure you that I did most of the configuration correct since I have NO TROUBLE getting xdebug to work with XAMPP on linux. So obviously the issue is with the ‘raw’ install. Hopefully, I finally got the solution after 2hr05mins (Ya, I’m very much stubborn to get things work the way I want it on my nix 😉 )
Steps I Did To Install Xdebug Initially
Initially, I installed xdebug via the GUI Synaptic Package Manager. Then I configured my php.ini to load the xdebug like a zend extension and added some configurations. But dammm, it would not work at all.
Steps I Did To Re-Install Xdebug
Somehow I asked myself ‘why not re-install the xdebug‘, but this time via my favorite Bash Shell. Afterall I did all the raw LAMP install via the shell. Bingo! I did $ sudo apt-get install php5-xdebug and it installed it as expected BUT with an additional thing. Keep on reading..
Xdebug Needs An xdebug.ini File With PHP 5.3.x
The installation via the Shell, has created an additional xdebug.ini in my /etc/php5/conf.d/ folder. This file is new to me, never in the past did I had to create that file, or may be installing Xdebug with XAMPP is a different approach. That xdebug.ini simply had the line: zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so in it.
I think that may be to load xdebug as a zend extension, that path should be registered in its separate file. I re-opened my php.ini and removed that entry there, leaving the other configurations untouched. I restarted Apache2 and Voila! Finally xdebug is now enabled.. holy crap, it took me some precious time for such a simple thing (which would not otherwise have been obvious though)!
Do you have something to say about this matter? May be you know why we need this additional xdebug.ini? Please use the comment form to explain/say something..