How to Install, Configure and Use Xdebug on Ubuntu 13.10

I had a hard time trying to install Xdebug on Ubuntu 13.10. Luckily, Damian helped me last weekend at the Magento Hackathon in Leipzig – thanks again! Now I wanted to share the knowledge and explain, how you can easily install and use Xdebug on Ubuntu – especially together with PhpStorm.

  1. Install the php5-xdebug package:
    sudo apt-get install php5-xdebug
  2. Create the xdebug.ini configuration file:
    sudo vim /etc/php5/conf.d/xdebug.ini

    With the following content (make sure that the path to the extension is correct):

    zend_extension=/usr/lib/php5/20121212/xdebug.so
    xdebug.remote_host = localhost
    xdebug.remote_enable = 1
    xdebug.remote_port = 9000
    xdebug.remote_handler = dbgp
    xdebug.remote_mode = req
    
  3. Configure your IDE to use Xdebug. In PhpStorm go to File – Settings – PHP – Debug. Make sure that under „Xdebug“ the port is set to 9000 and all three checkboxes are ticked. Then go to Run – Edit Configurations – PHP Remote Debug. Select the correct server or create one and make sure that the debugger is set to „Xdebug“. You may want to use path mappings if you use symlinks like in a modman-environment.
  4. Install an Xdebug extension for your browser – I decided to use „Xdebug Helper for Firefox“ in Firefox and Xdebug helper for Chrome.
  5. Use it 🙂 In PhpStorm, set a break point by clicking on the left hand bar of the code, press the „Start Listen PHP Debug Connections“ button in the top menu bar, open the page you want to debug with Firefox, click the „Enable Debug“ icon in the bottom bar and reload the page. PhpStorm should then get the focus again and a debug perspective should appear.

Happy debugging!

4 Gedanken zu „How to Install, Configure and Use Xdebug on Ubuntu 13.10“

  1. Hello.

    This was the only way I could get xdebug installed and running. All describtions from xdebug website etc. didn’t work. But when installing phpmyadmin I get this error: http://bugs.xdebug.org/view.php?id=916

    phpize –version output:
    PHP Api Version: 20100412
    Zend Module Api No: 20100525
    Zend Extension Api No: 220100525

    System Info from phpinfo():
    Linux MF-UBUNTU 3.8.0-34-generic #49~precise1-Ubuntu SMP Wed Nov 13 18:05:00 UTC 2013 x86_64
    PHP Version 5.4.22-1+debphp.org~precise+1
    Apache 2.2.22

    Any ideas what the problem is?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert