2015-08-31 52 views
1

我在Laravel 5中遇到了一些問題。我在我的服務器上安裝了PHP和Apache,我用作曲者安裝了Laravel composer create-project laravel/laravel foldername,但是我嘗試訪問瀏覽器中的/ public文件夾,看到一個白頁,開發日誌說500內部服務器錯誤。Laravel白頁500內部服務器錯誤

在我的Apache錯誤日誌,我有以下: [Mon Aug 31 19:19:15.855570 2015] [:error] [pid 23556] [client 10.0.2.2:58505] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/test/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/test/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 /var/www/test/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#3 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(49): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException))\n#4 /var/www/test/app/Exceptions/Handler.php(33): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(Symfony\\Component\\Debug\\Ex in /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87 [Mon Aug 31 19:19:22.865065 2015] [:error] [pid 23557] [client 10.0.2.2:58507] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/test/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/test/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 /var/www/test/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n#3 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(49): Monolog\\Logger->error(Object(UnexpectedValueException))\n#4 /var/www/test/app/Exceptions/Handler.php(33): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))\n#5 /var/www/test/vendor/laravel/framework/src/Illuminate/ in /var/www/test/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87

我有像20或在我的日誌或多或少相同entrys 30。

我設定的權利: chown -R :www-data /var/www/test chmod -R 755 /var/www/test chmod -R 777 /var/www/test/storage

任何想法如何,我可以得到Laravel和運行? (宅基地不可能用於我的項目)

+0

什麼是對'的/ var/WWW設置當前權限/測試/存儲/日誌/ laravel.log'?做一個'ls -al/var/www/test/storage/logs/laravel.log'。 – jszobody

+0

'chmod -R 777/var/www/test/storage/logs /'怎麼辦? – MozzieMD

+0

777不會改變任何東西。在我的文件夾中沒有laravel.log,日誌文件夾爲空 –

回答

7

根據Laravel文檔(http://laravel.com/docs/5.0/configuration#after-installation),存儲和供應商內的文件夾應具有Web服務器的寫入權限。

我想你應該像這樣運行:

chmod -R 777 /var/www/test/storage 
chmod -R 777 /var/www/test/vendor 
+0

我試了一下,但還是不行 –

+0

我用touch創建了一個laravel.log文件,但是我得到了一個新的錯誤: 'ErrorException in Filesystem.php line 81: file_put_contents(/ var/www/html/servmin/storage/framework/views/d321637e45680774d1b2a91efcaf26b1):無法打開流:權限被拒絕 –

+0

我已經重現了你所做的同樣的問題。這完全取決於權限和所有權。一旦我改變了項目的所有權,laravel文件系統就無法訪問日誌。我認爲你應該確保這些:這個文件/ var/www/html/servmin/storage/framework/views/d321637e45680774 d1b2a91efcaf26b1(它應該與其他文件具有相同的所有權)。什麼是權限和所有權 – Binggre

0

由於@Binggre建議,你應該包括這個命令以及

chmod -R 777 /var/www/test/bootstrap/cache