PHP

Xdebug

SSH tunnel for debugging

ssh -f -N -R <remote_port>:localhost:<local_port> user@server

How to debug console command

export XDEBUG_CONFIG="idekey=PHPSTORM remote_host=localhost"; export PHP_IDE_CONFIG="serverName=srvname.local";

Common syntax

export PHP_IDE_CONFIG="serverName=srvname.local";export XDEBUG_CONFIG="idekey=PHPSTORM";/usr/bin/php -dxdebug.remote_autostart=1 -dxdebug.remote_host=192.168.15.1 -dxdebug.remote_enable=1 -dxdebug.remote_mode=req $* <command_with_params>

Debugging PHP apps under docker in PHPStorm

Here described how to easily run PHP app under docker with Xdebug support. To simplify:

  • build your app container on specially prepared container by Jetbrains, for example phpstorm/php-71-apache-xdebug-26

  • Add xdebug configuration in PhpStorm as described

  • It works (it worked for me even without Xdebug helper in browser)

array merging operators in PHP

Description