Marijan Šuflaj
ZgPHP, 2017
phpinfo()
ini_get('xdebug.remote_enable')
For the rest of the slides, assume
xdebug.remote_enable=1
XDEBUG_SESSION_START
in $_GET
/$_POST
XDEBUG_SESSION
in $_COOKIE
xdebug.remote_port
xdebug.remote_host
xdebug.remote_connect_back
xdebug.remote_addr_header
tcpdump
on both server and clientxdebug.remote_autostart
#start server on port 8888 without autostart
docker run \
-it --rm \
-w "$(pwd)" -v "$(pwd)":"$(pwd)" \
-p 8888:8888 \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=0 \
-S 0.0.0.0:8888
#start tcpdump on port 9000
tcpdump -t -q -i lo0 'port 9000'
#make a request
wget 'http://127.0.0.1:8800/index.php' \
-O /dev/null
#make a request using trigger
wget 'http://127.0.0.1:8800/index.php?XDEBUG_REMOTE_START' \
-O /dev/null
#start server on port 8888 with autostart
docker run \
-it --rm \
-w "$(pwd)" -v "$(pwd)":"$(pwd)" \
-p 8888:8888 \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=1 \
-S 0.0.0.0:8888
#start tcpdump on port 9000
tcpdump -t -q -i lo0 'port 9000'
#make a request
wget 'http://127.0.0.1:8800/index.php' \
-O /dev/null
#make a request using trigger
wget 'http://127.0.0.1:8800/index.php?XDEBUG_REMOTE_START' \
-O /dev/null
#run script under same file path
docker run \
-it --rm \
-w "$(pwd)" -v "$(pwd)":"$(pwd)" \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=1 \
null.php
#run script under different file path
docker run \
-it --rm \
-w "/app" -v "$(pwd)":"/app" \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=1 \
null.php
#run script under different file path
#with configured server
docker run \
-it --rm \
-w "/app" -v "$(pwd)":"/app" \
-e PHP_IDE_CONFIG='serverName=Demo' \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=1 \
null.php
remote_autostart=1
, remote_connect_back=0
and fixed remote_host
remote_connect_back
if neededremote_autostart
if needed#start redis server named "redis"
#that will be used
docker run \
--rm -it \
--name redis
redis
#start a script in two separate terminals
#using link to redis
docker run \
-it --rm \
-w "$(pwd)" -v "$(pwd)":"$(pwd)" \
--link redis \
php-xdebug:7.1 \
-dxdebug.remote_enable=1 \
-dxdebug.remote_autostart=1 \
parallel-execution.php