Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes on httpd without reload #1492

Closed
Maleksafi opened this issue Feb 4, 2024 · 6 comments
Closed

Changes on httpd without reload #1492

Maleksafi opened this issue Feb 4, 2024 · 6 comments

Comments

@Maleksafi
Copy link

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

@pompushko
Copy link

+1

@tianon
Copy link
Member

tianon commented Feb 5, 2024

Unfortunately, I'm not actually able to reproduce: 😅

$ 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 😭)

@Maleksafi
Copy link
Author

Maleksafi commented Feb 5, 2024

@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?

@tianon
Copy link
Member

tianon commented Feb 5, 2024

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.)

@Maleksafi
Copy link
Author

@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

@Maleksafi Maleksafi reopened this Feb 6, 2024
@Maleksafi Maleksafi reopened this Feb 6, 2024
@tianon
Copy link
Member

tianon commented Feb 6, 2024

Excellent, glad you got it figured out!

@tianon tianon closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants