docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.79k stars 2k forks source link

Php.ini never apply in php-8.1-apache arm #1409

Closed lenoira closed 1 year ago

lenoira commented 1 year ago

"The PHP.ini has the correct permissions 644 in /usr/local/etc/php/PHP.ini. The issue does not occur on the php-fpm image nor on the php-8.1-bullseye image. The PHP.ini is never taken into account."

tianon commented 1 year ago

I can't seem to reproduce, can you provide a bit more context?

lenoira commented 1 year ago

Thanks for your help

My problème is just on the php.ini i want change the post_max_size = 500M. I have copy the php.ini "php.ini-production" more my option post_max_size.

No problème on image php:8.1-apache-bullseye. I precise i use the arm image on Mac M2.

My configuration:

docker-compose-arm.yml

version: '3'
networks:
  default:
    ipam:
      config:
        - subnet: 172.20.0.0/24
services:
    front:
      build:
          context: ${GLOBAL_PATH}/dockerconf/front/.
          dockerfile: ./Dockerfile-arm
      expose:
        - 80
        - 443
      volumes:
        - ${GLOBAL_PATH}/front:/app
        - ${GLOBAL_PATH}/data/data:/app/public/data
        - ${GLOBAL_PATH}/haproxy/dockerconf/front/php.ini:/usr/local/etc/php/php.ini
        - ${GLOBAL_PATH}/haproxy/dockerconf/front/customphp.ini:/usr/local/etc/php/conf.d/customphp.ini
        - ${GLOBAL_PATH}/haproxy/dockerconf/front/sites-available:/etc/apache2/sites-available
        - ${GLOBAL_PATH}/haproxy/dockerconf/certs/test.evz.crt:/etc/ssl/certs/xxxxxxxx.crt
        - ${GLOBAL_PATH}/haproxy/dockerconf/certs/test.evz.key:/etc/ssl/private/xxxxxx.key
      #command: sh -c "chown -R root:root /app"
      links:
        - database
      environment:
        PHP_DISPLAY_ERRORS: 1
        WEB_DOCUMENT_ROOT: /app/public
        APACHE_LOG_DIR: /var/log/apache2
        WEB_SERVER_NAME: xxxxxxx

Dockerfile-arm

FROM php:8.1-apache

# add some build tools
RUN apt-get update && \
    apt-get install -y --force-yes \
    curl \
    zip \
    git \
    vim \
    wget

# COMPOSER v2
RUN wget https://getcomposer.org/download/latest-2.x/composer.phar
RUN mv composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer

# NODE & NPM
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y --force-yes \
    build-essential \
    nodejs

#enable module php
RUN docker-php-ext-install mysqli pdo_mysql exif

#enable module apache
RUN a2enmod rewrite headers expires ssl

#enable vhost https
RUN a2ensite default-ssl.conf
tianon commented 1 year ago

I created something a bit smaller to hopefully reproduce, and still wasn't able to: :sweat_smile: (so my best guess is that your problem is probably hiding somewhere else, and I'd suggest trying a proper/dedicated support forum such as the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow for further help digging)

FROM php:8.1-apache

RUN echo 'post_max_size = 500M' > /usr/local/etc/php/php.ini

RUN echo '<?php phpinfo();' > /var/www/html/index.php
$ docker build . --pull
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM php:8.1-apache
8.1-apache: Pulling from library/php
f03b40093957: Already exists 
662d8f2fcdb9: Pull complete 
78fe0ef5ed77: Pull complete 
4e258eed73a3: Pull complete 
1ddd4f300547: Pull complete 
0edd0b2ea53b: Pull complete 
ee9d310c9717: Pull complete 
10f4ca99bf3f: Pull complete 
aa560a783174: Pull complete 
828f2c4fe346: Pull complete 
92571fee089f: Pull complete 
3a5c97571a46: Pull complete 
2848e7859ccd: Pull complete 
Digest: sha256:fd22bc8f8e13c635bff418a1d9416e6544bb6ceae17167098ff68cdc9ede6a8e
Status: Downloaded newer image for php:8.1-apache
 ---> 0bb33ced849a
Step 2/3 : RUN echo 'post_max_size = 500M' > /usr/local/etc/php/php.ini
 ---> Running in d54f36413c28
Removing intermediate container d54f36413c28
 ---> 77fe3d87275a
Step 3/3 : RUN echo '<?php phpinfo();' > /var/www/html/index.php
 ---> Running in 6a9793cad844
Removing intermediate container 6a9793cad844
 ---> b8fd858103b1
Successfully built b8fd858103b1

$ docker run -dit --name test b8fd858103b1
6805bdf5642f565fd8673dbd17b509dad6dba75788bea4249131286afa7f2551

$ docker exec test curl -fsSL localhost | grep post_max_size
<tr><td class="e">post_max_size</td><td class="v">500M</td><td class="v">500M</td></tr>