magento / magento/magento-cloud-docker

php-fpm executing php-scripts as root

Open
#373 1 comment 1 reaction 0 assignees View on GitHub
Progress: ready for grooming
Dominant language
PHP
Stars
277
Forks
187
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/magento/magento-cloud-docker/blob/develop/images/php/8.3-fpm/etc/php-fpm.conf#L6

There is no user directive, so by default php-fpm will try to run as root, which is allowed since the -R flag is used: https://github.com/magento/magento-cloud-docker/blob/develop/images/php/8.3-fpm/Dockerfile#L151

This in turn can create files as root, like stuff in /app/generated/...

Then when trying to switch to and from developer mode from the cli container (as user www), you will get permission issues.

Very strange that this is the default for an official magento container, is has to be a bug right?

Contributor guide

Open the contributing guide

Research direction

Inspect images/php/8.3-fpm/etc/php-fpm.conf at line 6 and images/php/8.3-fpm/Dockerfile at line 151 to confirm the effective PHP-FPM worker user and root-related startup behavior. Reproduce the generated-file ownership problem and verify that PHP processes no longer create root-owned files and that developer-mode switching from the CLI container avoids permission errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
backend, infrastructure, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.