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.
- Install the php5-xdebug package:
sudo apt-get install php5-xdebug
- 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
- 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.
- Install an Xdebug extension for your browser – I decided to use „Xdebug Helper for Firefox“ in Firefox and Xdebug helper for Chrome.
- 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.