• amila

    (@flatworld21)


    the user of wordpress is apache, and its group is www
    I have to write a file /etc/httpd/myconfig.txt, which belongs to root.
    How can I write with file_put_contents?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    You can’t. That’s not how this sort of thing works.

    Why would you think that is even possible? It’s not. That’s intentionally not possible.

    Thread Starter amila

    (@flatworld21)

    Thank you.
    Because I have to give any one an account in my server whoever registers.
    So I have to add user to the config file.
    The only way is to give the config file 777 permission but it is not safe

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Allowing a web process to write files as root is arguably much less safe.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to write a file belong to root user’ is closed to new replies.