Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

file_put_contents permission denied

题主的环境是vmware+ubuntu+laravel+nginx+mysql

设置了vm的共享文件夹在ubuntu下的地址/mnt/hgfs/htdocs/data_web

htdocs的权限如下
图片描述
laravel项目的权限如下
图片描述
nginx的权限如下 图片描述

代码中有使用 file_put_contents 函数,具体报错如下
file_put_contents(/mnt/hgfs/htdocs/data_web/storage/ad_110309.html): failed to open stream: Permission denied

尝试过一下几个思路

php artisan cache:clear

chmod -R 777 storage

composer dump-autoload

但是都没有用,猜想是否需要把www这个用户加入到vm的共享文件夹用户权限,类似于https://segmentfault.com/a/11...这个问题下的解决思路,但是不知该如何添加?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这个目录是本地挂载上去的吧,看看本地文件的权限。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...