0712-2888027 189-8648-0214
微信公眾號(hào)

孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

當(dāng)前位置:主頁(yè) > 技術(shù)支持 > PHP > Laravel遷移數(shù)據(jù) could not be opened in append mode: failed to open stream: Permission denied錯(cuò)誤問(wèn)題的解決

Laravel遷移數(shù)據(jù) could not be opened in append mode: failed to open stream: Permission denied錯(cuò)誤問(wèn)題的解決

時(shí)間:2026-03-27來(lái)源:風(fēng)信官網(wǎng) 點(diǎn)擊: 760次

Laravel遷移數(shù)據(jù) could not be opened in append mode: failed to open stream: Permission denied錯(cuò)誤問(wèn)題的解決

在進(jìn)行Laravel項(xiàng)目的遷移過(guò)程中,在新的平臺(tái)因?yàn)闄?quán)限等因素導(dǎo)致出現(xiàn)如下錯(cuò)誤信息:

UnexpectedValueException
The stream or file "/www/wwwroot/m.shopglobalweb.com/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied 



這個(gè)是屬于常見(jiàn)的權(quán)限問(wèn)題,服務(wù)器的 storage 和 bootstrap/cache 目錄沒(méi)有寫(xiě)入權(quán)限,Laravel 無(wú)法生成日志、緩存文件。
錯(cuò)誤核心:/www/wwwroot/www.xxxxxx.com/storage/logs/laravel.log 權(quán)限不足,無(wú)法寫(xiě)入。

進(jìn)入項(xiàng)目根目錄后執(zhí)行這條命令:

# 1. 給 storage 目錄賦予讀寫(xiě)權(quán)限
chmod -R 755 storage
chmod -R 755 bootstrap/cache

# 2. 最關(guān)鍵:修改目錄所屬用戶(hù)(解決寶塔面板權(quán)限問(wèn)題)
chown -R www:www storage
chown -R www:www bootstrap/cache

如果還有錯(cuò)誤提示信息,我們需要執(zhí)行清空緩存命令:

php artisan cache:clear
php artisan config:clear


您可能感興趣的相關(guān)文章:

欄目列表
推薦內(nèi)容
熱點(diǎn)內(nèi)容
展開(kāi)