Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何为www数据用户设置umask?_Php_Umask - Fatal编程技术网

Php 如何为www数据用户设置umask?

Php 如何为www数据用户设置umask?,php,umask,Php,Umask,我目前正在使用PHP7.0.6FPM运行Apache/2.4.10(DebianJessie) 现在我需要将umask 0002添加到php fpm.conf中的所有要点,以便www-data用户使用rw-rw-r权限创建文件 我希望这能起作用,请这样试试 手动编辑/etc/systemd/system/multi-user.target.wants/php7.0-fpm.service文件,并在[service]部分中添加UMask=0002行 以前是这样的 然后 运行命令systemctl

我目前正在使用PHP7.0.6FPM运行Apache/2.4.10(DebianJessie)


现在我需要将umask 0002添加到
php fpm.conf
中的所有要点,以便
www-data
用户使用
rw-rw-r
权限创建文件

我希望这能起作用,请这样试试

手动编辑
/etc/systemd/system/multi-user.target.wants/php7.0-fpm.service
文件,并在[service]部分中添加
UMask=0002

以前是这样的

然后

运行命令
systemctl后台程序重新加载

然后

运行命令systemctl restart php7.0-fpm.service

现在,服务文件如下所示:

[Unit]
Description = The PHP FastCGI Process Manager
After = network.target

[Service]
Type = notify
PIDFile = /var/run/php/php7.0-fpm.pid 
ExecStartPre = /usr/lib/php/php7.0-fpm-checkconf
ExecStart = /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
ExecReload = /bin/kill -USR2 $MAINPID
; Added to set umask for files created by PHP
UMask = 0002

[Install]
WantedBy = multi-user.target

NB:您不能使用
systemctl
edit php7.0-fpm.service命令,因为在
systemctl
version 218中引入了编辑选项,但Debian 8附带了版本215。

我希望这能起作用,请尝试这种方法

手动编辑
/etc/systemd/system/multi-user.target.wants/php7.0-fpm.service
文件,并在[service]部分中添加
UMask=0002

以前是这样的

然后

运行命令
systemctl后台程序重新加载

然后

运行命令systemctl restart php7.0-fpm.service

现在,服务文件如下所示:

[Unit]
Description = The PHP FastCGI Process Manager
After = network.target

[Service]
Type = notify
PIDFile = /var/run/php/php7.0-fpm.pid 
ExecStartPre = /usr/lib/php/php7.0-fpm-checkconf
ExecStart = /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
ExecReload = /bin/kill -USR2 $MAINPID
; Added to set umask for files created by PHP
UMask = 0002

[Install]
WantedBy = multi-user.target

NB:您不能使用
systemctl
edit php7.0-fpm.service命令,因为在
systemctl
version 218中引入了编辑选项,但Debian 8附带了215版。

谢谢您的回答,但我只需要通过配置文件来完成。我无法编辑service.FWIW这似乎对我使用Debian 8.9没有帮助-特别是在完成所有步骤后,我运行了
sudo-u www-data-touch-foo
,旧的umask仍在使用。欢迎您的建议…谢谢您的回答,但我只需要通过配置文件来完成。我无法编辑service.FWIW这似乎对我使用Debian 8.9没有帮助-特别是在完成所有步骤后,我运行了
sudo-u www-data-touch-foo
,旧的umask仍在使用。欢迎您的建议。。。