Current situation: I have  local web-server running and just php5-cli (plus a few extensions) installed as most of the development I do will make use of a Vagrant machine. From time to time I develop small tools or libs which I like to debug on the command line. This is an overview how I configured my Ubuntu 14.04 box to handle debugging with Xdebug and phpstorm. Install the Xdebug extension via pecl: sudo apt-get install dh-make-php php5-dev
sudo pecl install xdebug
Create xdebug.ini config file in /etc/php5/mods-available/xdebug.ini: ; configuration for xdebug module
; priority=20
zend_extension=/usr/lib/php5/20121212/xdebug.so

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Enable the xdebug extension: sudo php5enmod xdebug Add environment variables to ~/.bashrc (and reload it afterwards): export PHP_IDE_CONFIG="serverName=localhost"
export XDEBUG_CONFIG="idekey=PHPSTORM"
Configure phpstorm: In Settings > Languages & Frameworks > PHP > Servers create a new entry. Give it a name (e.g. localhost) and set the Host to “localhost” (needs to match the serverName defined in your PHP_IDE_CONFIG environment variable. Set the port to 80 and choose Xdebug as a debugger. No need to validate the settings. This is all it takes. Now turn on the debug mode in phpstorm, set a breakpoint and run your script. phpstorm should be able to communicate with Xdebug now.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.