Closed Maleksafi closed 5 months ago
+1
Unfortunately, I'm not actually able to reproduce: :sweat_smile:
$ echo '<?php echo "foo\n";' > index.php
$ docker run -dit --name foo --mount type=bind,src="$PWD",dst=/var/www/html,ro --pull=always php:apache
apache: Pulling from library/php
Digest: sha256:7852b16fb672b5ae8acc4a0e3120152fa281e40f0b182aff4a192c5537d966d9
Status: Image is up to date for php:apache
c9457e39dbb3f6e264ca841ceb6a7e209fc74726769da462a2cbdc301899a6a9
$ docker exec foo curl -fsSL localhost
foo
$ echo '<?php echo "bar\n";' > index.php
$ docker exec foo curl -fsSL localhost
bar
Perhaps you've got some over-aggressive cache enabled? (PHP's own opcache
, perhaps?)
(Edit: updated with the command I used to change index.php
:sob:)
@tianon Can you find my Dockerfile
FROM php:8.1.24-apache
# Update and install dependencies
RUN apt-get update && apt-get --no-install-recommends install -y \
apache2-utils \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev
COPY ./php.ini /usr/local/etc/php/php.ini
RUN a2enmod vhost_alias mpm_prefork rewrite php alias autoindex
docker-compose.yml
version: '3'
services:
docker:
image: docker_httpd
ports:
- 80:80
volumes:
- /app:/app
- ./apache2.conf:/etc/apache2/apache2.conf
- ./httpd-vhosts.conf:/etc/apache2/sites-enabled/httpd-vhosts.conf
/app had my PHP code, can try with PHP projects, have multiple files like Yii or Laravel app? I disabled opcache on php Any suggest?
Doing a2enmod
on php
is definitely odd, but not likely to cause the problem you've described.
Without more details about your php.ini
and your Apache configuration, it's really hard to say though, because those are definitely going to be what's at fault for overaggressive cache here.
Maybe you could work to create a more minimal reproducer? (Remove bits from your custom php.ini
, remove bits from your custom Apache config, etc until the problem no longer reproduces.)
@tianon Thank you for your reponse The issue was fixed by disabling opcache ext on php.ini
opcache.enable=0
and i move php.ini to docker compose instead of docker file and it was working fine. Thank you
Excellent, glad you got it figured out!
I have apache -php on docker container and it has bind mount volume, when updating files inside mount volume it's reflected in the container , but the apache does not see these changes unless reloaded apache,
i want to see these changes on httpd without reload ,is this possible ?
Thanks