This Xdebug config works for debugging in FPM context: cat xdebug. With Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans Run docker ps to view the container name and docker exec -it container-name /bin/bash or docker exec -it container-name /bin/sh if you are using the alpine image. Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies When you run docker compose up -d Xdebug will be installed and the Xdebug configuration would be exported to the php.ini You can check if Xdebug has been set up for you. WSL - doesn't work, my php is not inside WSL, it is one level deeper - inside Docker that runs under WSL. ![]() Docker Compose - doesn't work, I don't have docker compose on Windows, everything is inside WSL "containers".Docker - I need to connect to a running container and not start a new one from the image (I need persistent database connection for that script), also the actual image that is supposed to be executed locally is a multi-stage image, PhpStorm doesn't support that.SSH - I don't have ssh server, and adding it to the container just for PhpStorm debugging sounds like an overkill.I think SERVER_PORT is generally not available when we are running things in CLI context.Īlso I can't setup CLI interpreter in PhpStorm properly: ![]() So Xdebug can clearly reach PhpStorm, all tips that I found on this JetBrains support forums, StackOverflow or otherwise on Google doesn't seem to solve the problem. Now I need to debug a CLI script and PhpStorm shows me following error: Cannot evaluate expression '$_SERVER' Once I'm in FPM context - I can debug things fine if I just have activated remote debugging in PhpStorm. My php 7.3 interpreter with Xdebug sits inside one of those containers. I'm running Docker Desktop for Windows in WSL2 mode. Step 2: Install Xdebug if you don’t have it installed yet (macOS user install Xdebug and PHP using this guide). In older versions of Xdebug port 9000 was the default but that port conflicts with php-fpm. ).Ĭhanging the port to something other than 9000 (portscans also reveal that none of them are in use).Īdding a firewall rule to allow incoming requests as described in (as well as restarting a couple times after adding the rule) New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action AllowĪdding options like xdebug.remote_enable=1 to the config, but this is being done by PhpStorm anyways when it runs the remote php instance ( remote_connect_back also did not do the trick): :php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9006 -dxdebug.remote_host=172.18.48.I'm running a Magento2 PHP app inside a set of docker containers that are orchestrated by docker-compose locally. Step 1: In PHPStorm set the Xdebug port to 9003 under Preferences Languages & Frameworks PHP Debug. This is for CLI only, I'm not trying to connect via php-fpm (so no Apache, nginx. E: Time-out connecting to client (Waited: 200 ms). This is what the Xdebug log shows: Log opened at 17:20:45 Whenever I run my tests with debugging enabled it says "Connection was not established.". WSL2 running Ubuntu 20, with PHP and php-xdebug installed. I am having trouble getting PhpStorm 2020.2 to work with xdebug with the following setup:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |