Laravel白页500内部服务器错误

时间:2015-08-31 20:05:49

标签: php laravel apache2 composer-php ubuntu-14.04

我在Laravel 5上遇到了一些问题。我在我的服务器上安装了PHP和Apache,我使用composer来安装Laravel var y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; for (var i=0; i<y.length;) { console.log(y[i]); console.log(y[i+1]); console.log(y[i+2]); i = i + 5; } 但是我尝试在我的浏览器中访问/ public文件夹我只看到一个白色页面和开发日志表示500内部服务器错误。

在我的apache错误日志中,我有以下内容: composer create-project laravel/laravel foldername

我的日志中有20或30个或多或少相同的内容。

我将权利设置为: [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 chown -R :www-data /var/www/test chmod -R 755 /var/www/test

任何想法如何让Laravel启动并运行? (宅基地不适合我的项目)

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

正如@Binggre建议的那样,你也应该包括这个命令

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