如何追查PHP5-FPM的umask设置是从Ubuntu的未来 [英] How to trace where php5-fpm umask settings are coming from on ubuntu

查看:543
本文介绍了如何追查PHP5-FPM的umask设置是从Ubuntu的未来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的AP preciate在跟踪和在Ubuntu的诊断问题的umask任何帮助:

I'd really appreciate any help in tracking down and diagnosing an umask issue on Ubuntu:

我跑 PHP5-FPM 与Apache通过 proxy_fcgi 。这个过程与0022一个的umask运行(通过让PHP确认发送的umask()的结果到一个文件[结果为'18'== 0022】)。我想改变这0002,但不能追查其中的umask的来源。

I'm running php5-fpm with Apache via proxy_fcgi. The process is running with a umask of 0022 (confirmed by having PHP send the results of umask() into a file [the result is '18' == 0022]). I'd like to change this to 0002, but can't track down where the umask is coming from.

Apache是​​否设定的umask 0002,并作为一个测试,如果我停用 proxy_fcgi 并运行我上面的测试中,我得到U +有摹RW访问的文件(和文件内容确定的umask为'2'== 0002)。

Apache is set with umask 0002, and as a test, if I disable proxy_fcgi and run my test above, I get a file with u+g having rw access (and the file contents confirm the umask as '2' == 0002).

如果我须藤-iu fpmuser 并运行的umask 的结果是0002处。

If I sudo -iu fpmuser and run umask the results are 0002.

系统信息:


  • PHP:5.5.3-1ubuntu2.1

  • 阿帕奇:2.4.6

  • Ubuntu的:13.10

  • PHP-PFM使用TCP端口列表(如Unix的端口都没有工作/支)

到目前为止,我已经试过以下(每个后跟一个系统重新启动和复试):

So far I've tried the following (each followed by a system restart and a retest):


  • 添加的umask 0002 来开始 /etc/init.d/php5-fpm

  • 添加 - 的umask 0002 启动 - 停止守护调用 /等/ init.d中/ PHP5-FPM

  • 添加的umask 0002 .profile文件 FPM的家用户

  • adding umask 0002 to the start of /etc/init.d/php5-fpm
  • adding --umask 0002 into the start-stop-daemon calls in /etc/init.d/php5-fpm
  • adding umask 0002 to .profile in the home of the fpm user

东西显然是调整了PHP-FPM过程中的umask - 所以,我怎么能开始跟踪什么强迫的umask 0022到PHP-FPM过程

Something is clearly adjusting the umask of the php-fpm process - so, how can I begin tracing what is forcing the umask 0022 onto the php-fpm process?

修改(1):


  • 通过 /etc/login.defs中调整全系统的umask(见的如何设置全系统的umask?)会影响其它地方的umask(例如通过comannds 须藤现在有0002一个的umask),但仍PHP-FPM创建的文件与0022注一个的umask,我验证了会议可选pam_umask.so 也被present在 /etc/pam.d/common-session-noninteractive 和我测试的002 0002使用umasks。

  • adjusting the system wide umask via /etc/login.defs (see How to set system wide umask?) affects the umask elsewhere (e.g. comannds via sudo now have a umask of 0002), but still php-fpm creates files with a umask of 0022. Note that I verified that session optional pam_umask.so was also present in /etc/pam.d/common-session-noninteractive and I tested umasks of 002 and 0002.

修改(2):


  • 我已经能够复制使用问题 nginx的 PHP5-FPM (使用Unix套接字设置为监听模式'0666')

  • 我很想追查umask的是来自,但我会满足于某种方式来迫使它我想要什么。

  • 我要补充一点,第一个测试是亚马逊的Ubuntu 13.10图像上完成。我在编辑2测试中使用的地方从头开始Ubuntu13.10服务器ISO设置的副本,在虚拟机中完成。所有安装都通过完成易于得到,而不是通过下载源和建设。

  • I have been able to replicate the issue using nginx and php5-fpm (using unix sockets set to listen mode '0666').
  • I would love to trace where the umask is coming from but I'd settle for some way to force it to what I want.
  • I should add that the first test was done on an Amazon Ubuntu 13.10 image. My tests in 'edit 2' where completed using a copy of the Ubuntu13.10 server ISO setup from scratch in a virtual machine. All installations were completed via apt-get rather than by downloading the source and building.

修改(3):


  • 我已确认我可以操纵的umask的手动的通过以下任一(通过检查创建的测试文件的权限验证):

  • I have confirmed I can manipulate the umask manually by either of the following (verified by checking the permissions on the test file created):

一个。在shell中,设置的umask然后运行 / usr / sbin目录/ PHP-FPM 从壳

a. In a shell, set a umask then run /usr/sbin/php-fpm from the shell

乙。在shell中,运行与任何umask值以下我想:

b. In a shell, run the following with whatever umask value I like:

 start-stop-daemon --start --quiet --umask 0002 --pidfile /var/run/php5-fpm.pid --exec /usr/sbin/php5-fpm -- --daemonize --fpm-config /etc/php5/fpm/php-fpm.conf


  • 然而,这的确切的同一命令 /etc/init.d/php5-fpm 文件的失败运行时调整的umask sudo的服务PHP5-FPM停止; sudo的服务PHP5-FPM启动或重启。

  • However this exact same command in the /etc/init.d/php5-fpm file fails to adjust the umask when running sudo service php5-fpm stop; sudo service php5-fpm start or at reboot.

    推荐答案

    而不是一个一般跟踪在那里的umask设置是从Ubuntu的未来(到目前为止我发现的唯一途径解决办法是复制过去的好努力工作方法这个问题,试图将其隔离到一个脚本或函数,那么退一步,通过每个脚本/函数被递归调用),但解决PHP5-FPM的umask问题即可。我发现在谷歌,计算器很多次,和其他地方的问题,但至今没有解决方案。希望这是有用的人。

    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.

    修改 /etc/init/php-fpm.conf 来包括行的umask 0002 (或任何的umask你希望)。我的版本的文件现在看起来是这样的:

    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
    

    说明

    已经通过服务跟踪命令,它的推出 PHP5-FPM 在启动时,它会运行一些检查(行118我复制)为的/ etc /初始化/ $ {}服务的.conf ,以及验证 initctl的是present并且可以报告它的版本。如果这些测试都通过和 新贵 用于这在 PHP5-FPM的情况下使用 /etc/init/php-fpm.conf 文件。

    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.

    借助 Ubuntu的暴发户网站给出了pretty明确的指示。特别是,您可以检查出新贵食谱您需要的具体细节。

    The ubuntu upstart site gives pretty clear instructions. In particular you can check out the upstart cookbook for the specifics you need.

    尽我所能找出这意味着,所以服务命令从未实际运行启动 - 停止守护... /etc/init.d/php5-fpm 这也是为什么我的previous编辑都无效果。相反,它假冒为新贵(实际上 initctl的)当您使用类似服务php5- FPM启动

    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.

    这篇关于如何追查PHP5-FPM的umask设置是从Ubuntu的未来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆