![]() ![]() Therefore you also need to configure an IDE that knows how to talk to Xdebug Xdebug interacts with IDEs to provide step debugging functionality, and Might be enough to allow port 9003, so iptables and iptables-persistent may be unnecessary.Xdebug's step debugger allows you to interactively walk through your code toĭebug control flow and examine data structures. I hope this helps, this was a real pita with very little to no documentation I could find online. Also, apache actually fills the SERVER_NAME property. Edit: this is mostly for IntelliJ / PHPStorm's sake I think which is picky.Īlso note that all this was only necessary for docker as using a LAMPP setup access on port 9003 is not regarded as an external connection as it comes from the same host. The nginx stuff for the server name is needed because nginx doesn't fill the SERVER_NAME key of the $_SERVER variable. "Docker" can be anything as long as it's the same as in the debug configuration described in the readme. You can make this persistent by installingĪdd (in addition to the recomendations in the readme) this to the overridden php.ini in the php-fpm dir:Īdd this line to the nginx/nf AFTER "include fastcgi_params " (otherwise it gets overridden): ![]() Sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 -dport 9003 -j ACCEPT Open port 9003 (for xdebug3) on the host machine (or see edit at the end of the post): I used a generated docker setup from phpdocker.io!, but to get it working on linux mint I had to do the following in addition to what it says in the readme generated alongside the docker / yaml files: I guess I need to make an article using Xdebug for microservices in docker dev env. Oh you'll also have to set up remote debugging session and map your local code base to corresponding container path via PHP servers configuration in PHPstorm as per usual when using docker. Not available on macos as it does not have direct access to container IP from host machine, hence why I reached out to Traefik in the first place as some of my team are on macs. Just make sure to assign different server_name in nginx prolly corresponding to url you are going to use. I guess you can also do this by creating docker subnets and assigning static IP's to your containers which when will allow to map their IP's to certain URL names in /etc/hosts file. And debugging sessions maps to that particular project alone which I intended to debug. With none of the /etc/hosts stuff or port mapping. ![]() Now, I ended up with different server names in nginx config which can correspond to url in my web browser. And when you call tagged url, it reroutes to appropriate service in docker to which Traefik alone can access. The Traefik itself binds to your localhost. Namely, none of the nginx web servers are exposed to my local machine. I've resolved this in my team by using Traefik in front of my docker containers. ![]() This does not happen if both project uses their own server name and are mapped to dedicated local machine url. As both processes are running on your local machine it's not clear which one of the projects are the "correct localhost". I think that happens due to server name resolution. The issue is that when you run multiple web servers lets say on different localhost ports Xdebug seemingly can't decide on which project code base to listen? And while you expect project B to start debugging session, for some reason project A initiates debugging session while both projects are open? Not entirely certain what's your issue but I hope I got it right. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |