wodby / php

Generic PHP docker container images
MIT License
155 stars 103 forks source link

SSMTP fails if PHP_FPM_USER is set. #169

Closed skilip closed 7 months ago

skilip commented 2 years ago

If the PHP_FPM_USER environment variable is set and SSMTP is used to send mail by setting the environment variable PHP_SENDMAIL_PATH to `'"/usr/bin/dos2unix -u | /usr/sbin/ssmtp -t -f"'`` ssmpt fails to send mails.

In the PHP container I stumbled upon this log message:

Could not find password entry for UID 501

After removing the environment variables PHP_FPM_USER and PHP_FPM_GROUP from docker-compose.yml the error dissappeared and SSMTP started working as expected.

I assume that the PHP FPM user should be known by, or ran by, SSMTP.

Since we need to change the PHP_FPM_USER to avoid file permission issues between Host OS and Docker containers we would be very glad if this issue is addressed.

skilip commented 2 years ago

Adding a user with the same UID as the value passed via PHP_FPM_USER solves this. Might not be the most proper solution though.

csandanov commented 2 years ago

why do you change the fpm user? if you need the default user with uid 501 you should just use -dev-macos image variants

Paulmicha commented 2 years ago

I'm also in a situation where I needed to change the FPM user (to wodby, uid 1000 gid 1000) in order to match the UID of the owner of the folder (a bind mount volume) on my machine, while avoiding permission issues - i.e. so that php-fpm can write files in a subdirectory of the bind mount.

I know the wodby user is added to the www-data group, cf. https://github.com/wodby/php/blob/master/7/Dockerfile#L39, but I still had errors like https://www.drupal.org/project/drupal/issues/2685957