Open MaskeZen opened 1 year ago
I have same problem also on Ubuntu. The container keeps recreating and the php.ini change is not persisting.
@vy-shmal, as a momentary fix to that I change the compose to mount a volume to that php.ini file.
I create the file ./env/php.ini
with the content of the original plus xdebug modifications:
memory_limit = 4G
max_execution_time = 1800
zlib.output_compression = On
cgi.fix_pathinfo = 0
date.timezone = UTC
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.idekey=VSCODE
upload_max_filesize = 100M
post_max_size = 100M
max_input_vars = 10000
sendmail_path = "/usr/bin/msmtp -t"
And then in the compose.yaml
file I add a volume...
services:
app:
build: images/nginx
ports:
- "80:8000"
- "443:8443"
volumes: &appvolumes
- ~/.composer:/var/www/.composer:cached
- ~/.ssh/id_rsa:/var/www/.ssh/id_rsa:cached
- ~/.ssh/known_hosts:/var/www/.ssh/known_hosts:cached
+ - "./env/php.ini:/usr/local/etc/php/php.ini"
- appdata:/var/www/html
- sockdata:/sock
- ssldata:/etc/nginx/certs
- #extra_hosts: &appextrahosts
+ extra_hosts: &appextrahosts
## Selenium support, replace "magento.test" with URL of your site
#- "magento.test:172.17.0.1"
+ - "host.docker.internal:host-gateway"
phpfpm:
image: markoshust/magento-php:8.1-fpm-1
volumes: *appvolumes
env_file: env/phpfpm.env
- #extra_hosts: *appextrahosts
+ extra_hosts: *appextrahosts
db:
image: mariadb:10.4
...
@MaskeZen Yes it worked for me also, nice thank you.
@MaskeZen Thanks. I have the same issue and this works with a small change like below. maybe help someone
- ~/.env/php.ini:/usr/local/etc/php/php.ini
I've been experiencing the same issue on Ubuntu 22.04.2 and, after some research, I've found that the issue seems to reside in the docker compose
command being called in bin/docker-compose
when running bin/start
.
To fix the issue I've just updated the bin/docker-compose
file as follows:
#!/bin/bash
if docker compose version > /dev/null 2>&1; then
- DOCKER_COMPOSE="docker compose"
+ DOCKER_COMPOSE="docker-compose"
else
DOCKER_COMPOSE="docker-compose"
fi
if [ "$1" == "--no-dev" ]; then
${DOCKER_COMPOSE} -f compose.yaml -f compose.healthcheck.yaml "${@:2}"
else
${DOCKER_COMPOSE} -f compose.yaml -f compose.healthcheck.yaml -f compose.dev.yaml "$@"
fi
I'm not sure why the docker compose
is behaving differently than docker-compose
, but might as well be a @docker internal issue.
Confirm same behavior on manjaro linux with Docker Compose version 2.16.0
phpfpm container is recreated and xdebug is never enabled.
If I downgrade to Docker Compose version 2.14.2 then xdebug gets enabled as expected.
@MaskeZen Thanks. I have the same issue and this works with a small change like below. maybe help someone
- ~/.env/php.ini:/usr/local/etc/php/php.ini
This depend on where you want to put your php.ini
file.
@rangerz is it possible that bin/docker-compose
script is returning a false positive on the first conditional check?
if docker compose version > /dev/null 2>&1; then
DOCKER_COMPOSE="docker compose"
else
DOCKER_COMPOSE="docker-compose"
fi
Hello @markshust , no, this is ok, almost in my case.
@xavierojeda what is your output of the above?
@xavierojeda what is your output of the above?
Hi @markshust. My output is the same as @MaskeZen's.
@xavierojeda try docker compose version
to check that you have docker compose installed.
@xavierojeda try
docker compose version
to check that you have docker compose installed.
Forgot to attach the output for that one. Here it is:
I have same problem also on Ubuntu. The container keeps recreating and the php.ini change is not persisting.
Going back to this... why is the container getting recreated? This doesn't make any sense. It should only start/stop, not get completely destroyed and then recreated.
@rangerz is it possible that
bin/docker-compose
script is returning a false positive on the first conditional check?if docker compose version > /dev/null 2>&1; then DOCKER_COMPOSE="docker compose" else DOCKER_COMPOSE="docker-compose" fi
I can't replicate
Any update for this issue?
Everytime that I execute bin/xdebug toggle the xdebug is not enabled. @markshust I have the latest version of your package.
This works:
bin/root sed -i -e 's/^xdebug.mode = off/xdebug.mode = debug/g' /usr/local/etc/php/php.ini
but when I try to use bin/restart phpfpm I can see that the restart reset the php.ini to the default values:
xdebug.mode = off
Why this happens?
thanks
Yea I really can't see why that would be happening, unless the container is completely destroyed when it shuts down.
I don't think the docker compose thing is any issue at all, as that line should properly return the exact version of docker compose you are running depending on the installed version.
That said, I'm not opposed to creating a new conf/php.ini
file in the compose
directory, as this would allow someone to easily edit the php.ini
file right on the host. And since this file is mounted from the local filesystem, it should absolutely persist container restarts. If someone wants to test this out locally, and if it works, make a PR, I'll take this in.
Thanks @MaskeZen , you save my time!
First of all, i made the changes @MaskeZen recommended and after that, still doesnt working.
So after some tests i had to increment some this changes to get all working as expected.
System:
Uncomment these lines in compose.yaml ` extra_hosts:
Add this entry on /etc/hosts
172.17.0.1 host.docker.internal
obs: To check the host you can paste this on your terminal docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}'
Change server path mapping on phpstorm servers to the "pub" directory, as the screenshot
/var/www/html/pub
Hope it helps someone!
I've been experiencing the same issue on Ubuntu 22.04.2 and, after some research, I've found that the issue seems to reside in the
docker compose
command being called inbin/docker-compose
when runningbin/start
.To fix the issue I've just updated the
bin/docker-compose
file as follows:#!/bin/bash if docker compose version > /dev/null 2>&1; then - DOCKER_COMPOSE="docker compose" + DOCKER_COMPOSE="docker-compose" else DOCKER_COMPOSE="docker-compose" fi if [ "$1" == "--no-dev" ]; then ${DOCKER_COMPOSE} -f compose.yaml -f compose.healthcheck.yaml "${@:2}" else ${DOCKER_COMPOSE} -f compose.yaml -f compose.healthcheck.yaml -f compose.dev.yaml "$@" fi
I'm not sure why the
docker compose
is behaving differently thandocker-compose
, but might as well be a @docker internal issue.
thanks , it's really helps!
@killvap I have same issue and try to fix like your way but i am getting this error
ERROR: The Compose file './compose.healthcheck.yaml' is invalid because: services.phpfpm.depends_on contains an invalid type, it should be an array services.app.depends_on contains an invalid type, it should be an array ERROR: The Compose file './compose.healthcheck.yaml' is invalid because: services.phpfpm.depends_on contains an invalid type, it should be an array services.app.depends_on contains an invalid type, it should be an array
I also encountered the same problem. If I just start the phpfpm service it works fine
docker compose -f compose.yaml -f compose.healthcheck.yaml -f compose.dev.yaml start php-fpm
Had the same issue on MacOS until I upgraded Docker Desktop to v4.20.1
and Docker Compose to v2.18.1
.
Had the same issue on MacOS until I upgraded Docker Desktop to
v4.20.1
and Docker Compose tov2.18.1
.
I can confirm that upgrading Docker Desktop solved this issue for me as well.
Thank you @mts527 for taking the time to leave this comment.
Description
When I try to enable the xdebug with
bin/xdebug enable
and the phpfpm service is restarted the container is recreated, and the value back to the original state.Steps To Reproduce
Expected Result
Actual Result