magicLAMP
magicLAMP copied to clipboard
[Question]: Xdebug integration
First of all, thank you for your work on magicLAMP! I'm really enjoying working with it!
This is not a feature request per se, I'm just interested in your opinion.
So my question is: What do you think about integrating Xdebug in the PHP docker images or have you may already planned to integrate it?
As I said, it's just a question. If there aren't any plans that's totally fine and in this case, it's easy to modify the Docker/php.ini files and run a docker-compose build to get it to work.
Hey,
Thanks for your kind words about magicLAMP, really pleased it has been useful for you and you're enjoying working with it.
Xdebug support is actually something I've been working on (see here). I've got this working on Linux perfectly with zero-configuration using the following php.ini
settings:
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
I just need to get it working on Windows and macOS, ideally with zero-configuration too, but this has proven difficult without a bit of configuration in regards to adding the host IP address to the xdebug config.
Which OS are you running magicLAMP on? I'd be really interested to know how you're getting it setup if you're running macOS or Windows.
Thanks for your answer and you're very welcome.
I'm working on Windows 10 with WSL 2 (Ubuntu 20.4).
Updated the docker-compose.override.yml
file:
services:
php74:
build:
context: ./containers/php74
the corresponding Dockerfile
(lines added):
...
pecl install xdebug && \
docker-php-ext-enable xdebug
...
and the php.ini
file:
[xdebug]
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_host=<my_host_ip_address>
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
After a docker-compose build
and docker-compose up
I triggered a debugging session with the Xdebug helper Browser debugging extension and let PhpStorm listen for debug connections after setting a breakpoint. Then the first time the breakpoint was hit I had to configure the path mapping in PhpStorm.
I hope this helps and let me know if I can provide you further information.
Thanks for this. Very helpful!
What I may have to do is add some environment variables to the .env
file for HOST_IP
and IDEKEY
.
Then when magicLAMP starts up, it can read in these variables and add them to php.ini
. This way you won't need to override anything.
You're welcome! Yes exactly, that's a good idea.