laravel報錯 "/xxx/laravel.log" could not be opened: failed to open stream: Permission denied


原文地址:https://www.wjcms.net/archives/laravel報錯xxxlaravellogcouldnotbeopenedfailedtoopenstreampermissiondenied

laravel報錯:The stream or file "/xxx/laravel.log" could not be opened: failed to open stream: Permission denied

今天在搭建一個laravel項目時,突然報上述錯誤,從字面意思上來看是沒有權限,解決這個問題當然從權限考慮。
可以直接將文件夾權限設置為777,但是這樣非常不安全,所以千萬別這么做。
應該更改目錄所有者。因此,設置當前用戶,使你以所有者身份登錄,並以webserver用戶(www,apache……)作為組登錄,這里運行下面兩條命令:

sudo chgrp -R www storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

即可成功解決上述問題。

關注我更多精彩


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM