Skip to content
Advertisement

Problem modifying JSON config file inside a container (PHP)

I have a problem modifying a JSON config file within a PHP7.4 container. Im supposed to be able to configure an HTTP GET request to make adjustments to this config file.

Ive ran the code on a PHP test server, with no issues, but cant seem to get the file permissions modified within the container.

Ive added the line RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" inside the Dockerfile, taken from Docker hub PHP-apache documentation page. This stops previously encountered file permission problems, however, when i send the container the relevant request, it doesnt show any PHP errors, but the file also isnt being modified.

My Dockerfile;

FROM php:7.4-apache 
COPY src/ /var/www/html/

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

Prior to building the container ive also ran CHMOD 755 filename on all files within my /src directory.

Ive tried modifying chown permissions as well, adding users (and running the container as an admin), but im getting Docker build errors when i try to add those features. What am I missing?

Advertisement

Answer

Answer; I tried upgrading my chown permissions to 777… and its working… thanks for anyone who read or looked.

chmod 777 filename|directory

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement