I have a php site that needs to access local files (the /var/www/html folder for example).
I have the following error and I think it's due to a right issue :
Warning: mkdir(): Permission denied in /var/www/html/lib/model/core/JsonData.php
For me, the apache user of the docker must have the rights to the local file.
I tested this but it crashes the docker-compose:
command: chown -R www-data:www-data /var/www/html
I test the no prod command chmod ugo+rwx /var/www/html in docker and the same but in local, it does not change anything.
My docker compose :
version: "3.7"
networks:
gc-net:
ipam:
driver: default
config:
- subnet: "172.20.111.0/24"
services:
gc-webserver:
image: chialab/php-dev:7.4-apache
restart: always
command: chown -R www-data:www-data /var/www/html
networks:
gc-net:
ipv4_address: 172.20.111.10
volumes:
# content
- /home/hadock/samus/Projects/intervalle/App/sites_web:/var/www/html
# logs
- ./apache_log:/var/log/apache2
# vhost
- ./vhost/001-gamecash.conf:/etc/apache2/sites-enabled/001-gamecash.conf
# apache modules
- ./apache_modules/rewrite.load:/etc/apache2/mods-enabled/rewrite.load
- ./apache_modules/expires.load:/etc/apache2/mods-enabled/expires.load
- ./apache_modules/filter.load:/etc/apache2/mods-enabled/filter.load
- ./apache_modules/deflate.load:/etc/apache2/mods-enabled/deflate.load
- ./apache_modules/ssl.load:/etc/apache2/mods-enabled/ssl.load
# cert
- ./ssl:/var/imported/ssl
# apache2.conf
- ./apache_conf/apache2.conf:/etc/apache2/apache2.conf
ports:
- "14080:80"
- "14443:443"
gc-mysql:
image: mysql:5.6.45
restart: always
networks:
gc-net:
ipv4_address: 172.20.111.20
volumes:
- /home/hadock/samus/Database/mysql-5:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root