Proper Way of Setting Umask For php-fpm on Debian/Ubuntu

Solution 1:

I know this is old, but for anyone else who comes along modifying www.conf and adding env[UMASK] = 0002 solved the problem. Note the three 000 before the 2, no two as in the respondent's answer above.

Solution 2:

Corresponding to the debian maintainer you can use the /etc/apache2/envvars for apache, so maybe there is a corresponding file for phpfpm? Also systemd has a umask setting in unit files, however I don't think it is honored if the service does not have a native systemd unit file.

Solution 3:

You can always change Umask for whole Systemd service by adding config file /etc/systemd/system/my-service-name-whatever.d/umask.conf with content like:

[Service]
UMask=0002