search

Home  >  Q&A  >  body text

php - file_put_contents permission denied

The environment of the subject is vmware+ubuntu+laravel+nginx+mysql

Set the address of the vm’s shared folder under ubuntu/mnt/hgfs/htdocs/data_web

The permissions of htdocs are as follows
##The permissions of laravel project are as follows

The permissions of nginx are as follows

The file_put_contents function is used in the code. The specific error is as follows

file_put_contents(/mnt/hgfs/htdocs/data_web/storage/ad_110309.html): failed to open stream: Permission denied

I tried a few ideas

php artisan cache:clear

chmod -R 777 storage

composer dump-autoload

But it’s useless. I wonder if the user www needs to be added to the vm’s shared folder user permissions, similar to the solution to this problem of /a/11..., but I don’t know how to add it?

漂亮男人漂亮男人2799 days ago584

reply all(1)I'll reply

  • PHPz

    PHPz2017-05-16 13:18:26

    This directory is mounted locally. Check the permissions of local files.

    reply
    0
  • Cancelreply