Skip to content

Instantly share code, notes, and snippets.

@radub
Last active November 8, 2018 13:33
Show Gist options
  • Save radub/9b14595e573170517839 to your computer and use it in GitHub Desktop.
Save radub/9b14595e573170517839 to your computer and use it in GitHub Desktop.
CLI xDebug phpunit
# xDebug
sudo apt-get install php-xdebug
# enable / disable
sudo phpdismod xdebug
sudo phpenmod xdebug
# xDebug CLI
# in PhpStorm set debugger port to 9001 if nginx
# add the line below to ~/.bashrc; {hostname} is the host you're accessing in the browser
export XDEBUG_CONFIG="idekey=PHPSTORM" PHP_IDE_CONFIG="serverName={hostname}"
# debug CLI script
php -dxdebug.remote_connect_back=Off -dxdebug.remote_port=9001 -dxdebug.remote_host={host_ip: ifconfig -a} {path_to_script}
# debug CLI phpunit test script
php -dxdebug.remote_connect_back=Off -dxdebug.remote_port=9001 -dxdebug.remote_host={host_ip: ifconfig -a} /usr/bin/phpunit -c {path_to_phpunit_config.xml} {path_to_test_script}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment