web-dev-qa-db-fra.com

Wordpress Docker n'augmentera pas la limite de chargement

J'essaie d'incrémenter la limite de téléchargement de mon instance Wordpress dockerisée à 150 Mo. 

[filename] exceeds the maximum upload size for this site.

J'ai créé un fichier uploads.ini et l'ai attaché par volume à l'instance. Pourtant, je ne parviens toujours pas à faire en sorte que le programme de téléchargement de média Wordpress augmente sa limite. 

Docker-compose.yml: 

version: '2'
services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: password1
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: password1

   wordpress:
     depends_on:
       - db
     build: ./wordpress
     ports:
       - "8085:80"
     restart: always
     environment:
       WORDPRESS_DB_Host: db:3306
       WORDPRESS_DB_PASSWORD: password1
     volumes: 
       - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini 
volumes:
    db_data:

uploads.ini: 

file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600

Docker inspecte le conteneur: 

[
    {
        "Id": "8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f",
        "Created": "2017-03-15T23:47:54.480206792Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "Apache2-foreground"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 15956,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-03-16T17:46:30.075247017Z",
            "FinishedAt": "2017-03-16T17:46:29.700791339Z"
        },
        "Image": "sha256:cfe94722592e66629527d7fc1546174916c758c6945eb9911506077e76c4d00e",
        "ResolvConfPath": "/var/lib/docker/containers/8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f/hostname",
        "HostsPath": "/var/lib/docker/containers/8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f/hosts",
        "LogPath": "/var/lib/docker/containers/8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f/8edc91a51bf8480edc927de2fa5c16624ac43a7beb58c109cd771a143f67746f-json.log",
        "Name": "/edgeofrevolt_wordpress_1",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
            "8efe40659ebd3e44b17d45f1dd2aac20f12e13a4513e41520d6c2a1b1f01aa08"
        ],
        "HostConfig": {
            "Binds": [
                "/root/NginxDockerProxyPass/edgeofrevolt/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini:rw",
                "374db2645434a23b92074b6d95935361948397519f2d5a531986bb925ceb0f53:/var/www/html:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "edgeofrevolt_default",
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "8085"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [],
            "CapAdd": null,
            "CapDrop": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Source": "/root/NginxDockerProxyPass/edgeofrevolt/uploads.ini",
                "Destination": "/usr/local/etc/php/conf.d/uploads.ini",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Name": "374db2645434a23b92074b6d95935361948397519f2d5a531986bb925ceb0f53",
                "Source": "/var/lib/docker/volumes/374db2645434a23b92074b6d95935361948397519f2d5a531986bb925ceb0f53/_data",
                "Destination": "/var/www/html",
                "Driver": "local",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "8edc91a51bf8",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "affinity:container==6797730d5702955f114fd260628b82615aa7702d0cafae7dae456b1806009437",
                "WORDPRESS_DB_Host=db:3306",
                "WORDPRESS_DB_PASSWORD=p0kem0n2468Y",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
                "PHP_INI_DIR=/usr/local/etc/php",
                "Apache_CONFDIR=/etc/Apache2",
                "Apache_ENVVARS=/etc/Apache2/envvars",
                "PHP_EXTRA_BUILD_DEPS=Apache2-dev",
                "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2",
                "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2",
                "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2",
                "PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie",
                "GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3",
                "PHP_VERSION=5.6.30",
                "PHP_URL=https://secure.php.net/get/php-5.6.30.tar.xz/from/this/mirror",
                "PHP_ASC_URL=https://secure.php.net/get/php-5.6.30.tar.xz.asc/from/this/mirror",
                "PHP_SHA256=a363185c786432f75e3c7ff956b49c3369c3f6906a6b10459f8d1ddc22f70805",
                "PHP_MD5=68753955a8964ae49064c6424f81eb3e",
                "WORDPRESS_VERSION=4.7.2",
                "WORDPRESS_SHA1=7b687f1af589c337124e6247229af209ec1d52c3"
            ],
            "Cmd": [
                "Apache2-foreground"
            ],
            "Image": "edgeofrevolt_wordpress",
            "Volumes": {
                "/usr/local/etc/php/conf.d/uploads.ini": {},
                "/var/www/html": {}
            },
            "WorkingDir": "/var/www/html",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "da7c1855141bc762874ddd4734f2b062556a041750ff48a3cfa3954bb7dfed6c",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "edgeofrevolt",
                "com.docker.compose.service": "wordpress",
                "com.docker.compose.version": "1.8.1"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "ceec8d1498a6988b4cc56ad10afa5cf87e0670d030460efbd26bd5ace185a375",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8085"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/ceec8d1498a6",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "edgeofrevolt_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "wordpress",
                        "8edc91a51bf8"
                    ],
                    "NetworkID": "89bde3d402cc2fe938279c30415cc2947f92205e610dff1acba69101440b90e7",
                    "EndpointID": "916db2fab99a1637aef87aa1f05fb702fb9b6d3692bf04a9bf46bf122fe9e990",
                    "Gateway": "172.23.0.1",
                    "IPAddress": "172.23.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:17:00:03"
                }
            }
        }
    }
]

EDIT: il y avait une faute de frappe dans 'upload_max_filesize'

12
Kyle Calica-St

J'ai découvert mon problème. 

docker-compose kill va tuer un conteneur mais le reconstruire à partir d'un cache. Cela signifie qu'aucun changement n'a été apporté à mes fichiers. 

Utilisez docker-compose up -d --build 

10
Kyle Calica-St

Il y a une faute de frappe dans vos uploads.ini

upload_max_fileszie => upload_max_filesize

0
user7832953

cela a fonctionné pour moi comme suit: J'ai créé uploads.ini dans mon répertoire local (où se trouve le fichier .yml) avec les lignes suivantes. c’est exactement comme cela que l’a déclaré le premier poteau.

file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600

après cela j'ai ajouté 

volumes: 
   - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

à mon fichier .yml comme il est indiqué dans le premier post. 

après cela, j'ai dû supprimer le conteneur/les images (en gros, recommencer à zéro):

docker stop [image name]
docker rm [image name]
docker image rm [image name]

certains endroits, je finis par utiliser un ID au lieu du nom de l'image. nom ou ID fondamentalement, vous devez vous arrêter, supprimer le conteneur et l'image. la ligne de fond est de recommencer à zéro avec une ligne supplémentaire dans votre fichier .yml comme décrit dans le premier message. rappelez-vous, vous perdrez tout votre travail wp . maintenant exécuté 

docker-compose up -d --build

la limite de téléchargement devrait être augmentée maintenant. J'ai été en mesure de télécharger mon nouveau thème plus grand après ce changement. pas plus d'erreur de taille de fichier de téléchargement. La seule question qui se pose est de savoir si vous auriez besoin d'augmenter cette taille limite de téléchargement au milieu de votre travail. Comment feriez-vous cela? ...

0
smaqsood