Not a solution for generically tracing where umask settings are coming from on ubuntu (the only way I've found so far is the good old hard work approach of replicating the issue, attempting to isolate it to a script or a function, then stepping back through each script/function that is called recursively) but a solution to the php5-fpm umask issue. I've found a lot of hits on google, stackoverflow, and elsewhere for the problem, but so far no solution. Hopefully this is useful for people.
Edit /etc/init/php-fpm.conf
to include the line umask 0002
(or whatever umask you wish). My version of the file now looks like this:
# php5-fpm - The PHP FastCGI Process Manager
description "The PHP FastCGI Process Manager"
author "Ondřej Surý <ondrej@debian.org>"
start on runlevel [2345]
stop on runlevel [016]
### my edit - change umask setting
umask 0002
pre-start exec /usr/lib/php5/php5-fpm-checkconf
respawn
exec /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf
Explanation
Having traced through the service
command which launches php5-fpm
at startup, it runs some checks (line 118 on my copy) for /etc/init/${SERVICE}.conf
, along with verifying initctl
is present and can report it's version. If these tests are passed then upstart
is used which in the case of php5-fpm
uses the /etc/init/php-fpm.conf
file.
The ubuntu upstart site gives pretty clear instructions. In particular you can check out the upstart cookbook for the specifics you need.
As best I can work out that means that therefore the 'service' command was never actually running the start-stop-daemon …
commands found in /etc/init.d/php5-fpm
which is why my previous edits were having no effect. Instead it passes off to upstart
(actually initctl
) when you use something like service php5-fpm start
, etc.