Can't write to /tmp with php, despite 777 permissions and no open_basedir value

前端 未结 4 1871
花落未央
花落未央 2020-12-29 02:16

I\'m trying to write a file to my /tmp directory (on an apache server) with the php fopen function, but it fails:

<         


        
4条回答
  •  [愿得一人]
    2020-12-29 02:50

    Your problem is likely caused by the combination of systemd and apache. It's a security feature called PrivateTmp, and obviously it's an opt out.

    If you don't want it, you can disable it like this:

    1. Outcomment the respective switch in /etc/systemd/system/multi-user.target.wants/apache2.service: #PrivateTmp=true
    2. Restart systemd: sudo systemctl daemon-reload
    3. Restart apache: sudo systemctl restart apache2

提交回复
热议问题