Answer the question
In order to leave comments, you need to log in
How to make PHP-FPM create folders with permissions 775 and files with 664?
Hello, please tell me, there is a project on laravel, I set up nginx and php-fpm, I created a new pool for the site:
/etc/php/7.4/fpm/pool.d/dev-my.conf
[dev-my]
user = dev-my
group = dev-my
listen = /run/php/php7.4-dev-my-fpm.sock
listen.owner = dev-my
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
dev-my
, the problem is that if my php script creates a folder or files, then the folders are created with rights - 755, and files - 644, but I would like the folders to be with rights 775 and files from 664. /storage/framework/views
in this folder there are cached view files. php artisan view:cache
I look in the views folder, there are now files with 664 rightsphp-fpm umask
, the examples that are did not work for me. Please tell me what could be the problem? Thank you in advance for your response.
Answer the question
In order to leave comments, you need to log in
1. You can set in scripts - umask() , but you need to be extremely careful and understand what you are doing
2. In php-fpm.conf you can also set umask = 0002 (to get 664) see How to change umask for user www- data in debian 7?
3. The "default" umask value can be set for the user with the umask command (for example, via ~/.bashrc), for cases when you execute commands in the artisan console after logging in, dev-my
see How to set the default umask?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question