How to run php-fpm as root

后端 未结 2 960
暖寄归人
暖寄归人 2021-02-19 00:55

I know the risks about running php-fpm as root. However there are situations where one would need to do it, like appliances, accessing operating system resources or ev

相关标签:
2条回答
  • 2021-02-19 01:36

    See:

    # php-fpm --help
    ...
     -R, --allow-to-run-as-root
                   Allow pool to run as root (disabled by default)
    
    0 讨论(0)
  • 2021-02-19 01:51

    Update 2018

    Running it within a container is a possible valid reason to run php-fpm as root. It can be done by passing the -R command line argument to it


    Original answer:

    However there are situations where one would need to do it, like appliances, accessing operating system resources

    You never need to do it. That's it. If you are managing system resources, grant permissions for the php-fpm user to that resources rather than running the whole process as root. If your question would be more specific I could show how to do that in a certain situation.

    0 讨论(0)
提交回复
热议问题