Skip to content

PHP Storm integration in WSL

Nils Wogatzky edited this page Jul 30, 2022 · 3 revisions

Execute docker php inside WSL

[[command]]
 name="php8"
 image="php:8.0"
 entryPoint="php"
 removeContainer=true
 impersonate=true
 volumes=[
    "${PWD}:${PWD}",
    "${PWD}/php/testproject:/opt/project"
 ]

for debugging

[[command]]
 name="php8"
 image="chrisb9/php8:cli-dev"
 entryPoint="php"
 removeContainer=true
 impersonate=true
 volumes=[
   "${PWD}:${PWD}",
    "${PWD}:/opt/project",
    "/mnt/c/Users/nils/AppData/Local/Temp:/mnt/c/Users/nils/AppData/Local/Temp", # required to execute phpinfo.php from PHPStorm
    "XDEBUG_CONFIG=${XDEBUG_CONFIG}"
 ]
 # remap to connect to host machine from docker
 replaceArgs=[
    [
        "-dxdebug.remote_host=127.0.0.1",
        "-dxdebug.remote_host=host.docker.internal"],[
        "-dxdebug.client_host=127.0.0.1",
        "-dxdebug.client_host=host.docker.internal"
    ]
]
# just for debugging the debugging connection
additionalArgs=["-dxdebug.log=/home/nils/php/testproject/xdebug.log"]
envvars=["XDEBUG_CONFIG=${XDEBUG_CONFIG}"]