nginx “Permission Denied”Laravel [duplicate]

tvmytwxo  于 2023-05-06  发布在  Nginx
关注(0)|答案(1)|浏览(255)

此问题已在此处有答案

file_put_contents(meta/services.json): failed to open stream: Permission denied(33答案)
From Laravel I got failed to open stream: Permission denied(4个答案)
4天前关闭。
我尝试安装网络应用程序“书库”。操作系统- Alt Server 10.1(像Debian)我几乎到达终点线,但我有emty页面,当我试图打开起始页。/var/log/nginx/error.log

2023/05/01 02:10:16 [error] 8093#8093: *7 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ErrorException: file_put_contents(/var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php): Failed to open stream: Permission denied in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:190
Stack trace:
#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/var/www/bookst...', 190)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}(2, 'file_put_conten...', '/var/www/bookst...', 190)
#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(190): file_put_contents('/var/www/bookst...', '<?php $__env->s...', 0)
#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(185): Illuminate\Filesystem\Filesystem->put('/var/www/bo...; PHP message: PHP Fatal error:  Uncaught ErrorException: file_put_contents(/var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php): Failed to open stream: Permission denied in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:190
Stack trace:
#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/var/www/bookst...', 190)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}(2, 'file_put_conten...', '/var/www/bookst...', 190)

这向我保证,我没有给予文件夹的权利,但我做了。文件夹“vendor”上的此示例出错。

drwxr-xr-x  4 _nginx _nginx  4096 апр 24 22:14 aws
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 bacon
drwxr-xr-x  4 _nginx _nginx  4096 апр 24 21:44 barryvdh
drwxr-xr-x  2 _nginx _nginx  4096 апр 24 22:54 bin
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 22:14 brick
drwxr-xr-x  2 _nginx _nginx 20480 апр 24 22:50 composer
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 dasprid
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 dflydev
drwxr-xr-x  8 _nginx _nginx  4096 апр 24 22:54 doctrine
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 dompdf
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 dragonmantank
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 22:14 egulias
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 fruitcake
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 graham-campbell
drwxr-xr-x  6 _nginx _nginx  4096 апр 24 22:14 guzzlehttp
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 intervention
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 knplabs
drwxr-xr-x  6 _nginx _nginx  4096 апр 24 22:14 laravel
drwxr-xr-x 10 _nginx _nginx  4096 апр 24 22:14 league
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 masterminds
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 monolog
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 mtdowling
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 nesbot
drwxr-xr-x  4 _nginx _nginx  4096 апр 24 21:44 nette
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 nikic
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 22:54 nunomaduro
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 onelogin
drwxr-xr-x  4 _nginx _nginx  4096 апр 24 21:44 paragonie
drwxr-xr-x  4 _nginx _nginx  4096 апр 24 21:44 phenx
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 phpoption
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 phpseclib
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 pragmarx
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 predis
drwxr-xr-x 10 _nginx _nginx  4096 апр 24 22:14 psr
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 22:14 psy
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 ralouphie
drwxr-xr-x  4 _nginx _nginx  4096 апр 24 22:14 ramsey
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 robrichards
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 sabberworm
drwxr-xr-x  9 _nginx _nginx  4096 апр 24 21:44 socialiteproviders
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 22:54 ssddanbrown
drwxr-xr-x 29 _nginx _nginx  4096 апр 24 22:54 symfony
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 tijsverkoyen
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 vlucas
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 voku
drwxr-xr-x  3 _nginx _nginx  4096 апр 24 21:44 webmozart

我还能做什么?
我尝试了清除php工匠缓存和典型的问题与“权限拒绝”,我发现在谷歌搜索。但什么都帮不了我。

lbsnaicq

lbsnaicq1#

你很接近了,只是文件夹不对。如果你仔细看看你的错误

2023/05/01 02:10:16 [error] 8093#8093: *7 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ErrorException: file_put_contents(/var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php): Failed to open stream: Permission denied in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:190

它指出您在运行file_put_contents(/var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php)时遇到权限错误。这意味着问题在于存储文件夹的权限,而不是供应商文件夹。因此,您应该确保/var/www/bookstack/storage/framework/views文件夹存在,并确保它具有适当的权限(我通常为目录给予775,为存储中的文件分配664)。

相关问题