處理file_put_contents failed to open stream

在運行時出現瞭如下錯誤:php

ErrorException in Filesystem.php line 81:file_put_contents(/var/www/mysite/bootstrap/cache/services.json): failed to open stream: Permission denied


從上邊的報錯能夠看出是因爲cache目錄沒有寫入的權限,因此給這個目錄寫入權限:shell

解決方法:json

# sudo chmod -R 777 /var/www/mysite/bootstrap/cache

權限777和755區別:bootstrap

777是全部用戶都有執行,讀,寫權限,755是root用可執行權限.文件所屬用戶和其它組用戶沒有執行權限!spa

相關文章
相關標籤/搜索