Giter Club home page Giter Club logo

Comments (6)

pompushko avatar pompushko commented on May 20, 2024

+1

from php.

tianon avatar tianon commented on May 20, 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 😭)

from php.

Maleksafi avatar Maleksafi commented on May 20, 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?

from php.

tianon avatar tianon commented on May 20, 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.)

from php.

Maleksafi avatar Maleksafi commented on May 20, 2024

@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

from php.

tianon avatar tianon commented on May 20, 2024

Excellent, glad you got it figured out!

from php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.