PHP-FPM – How to Set Umask for php5-fpm in Ubuntu 13.10

php-fpmumask

I am currently running nginx with php5-fpm on my local development ubuntu 13.10 system with 3.12.0 linux kernel.

Before update, to set umask to 0002 for php5-fpm I edited /etc/init.d/php5-fpm file and added --umask arg to start-stop-daemon line.

After update it is ignored.

All points that now I run upstart instead of bare old system V scripts.

I tried to add umask 0002 to /etc/init/php5-fpm.conf but no luck

Best Answer

After long boring google search the answer is:

umask 0002

In the very start of /etc/init.d/php5-fpm

I checked it with gdb to be really sure(gdb --pid=PID of php5-fpm):

(gdb) call umask(0)
$1 = 2
(gdb) call umask(2)
$2 = 0