访问 Laravel 5.8 时出现服务器错误 500
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55706113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Server error 500 when accessing Laravel 5.8
提问by Zulfikar Sandy Pratama
After installing laravel in blogdirectory, when I try to check it runs normally or not by accessing localhost/blog/publicit shows 500 Server errorlike this screenshot :
在博客目录中安装 laravel 后,当我尝试通过访问localhost/blog/public检查它是否正常运行时,它显示500 服务器错误,如下图所示:
I've tried to grant apache with mod_rewriteand it didn't help.
我尝试使用mod_rewrite授予 apache权限,但没有帮助。
I installed laravel with XAMPP in Windows.
我在 Windows 中使用 XAMPP 安装了 laravel。
======
======
UPDATE :
Here is the log file in the storage/logs/
and .envfile
link
更新:这是在日志文件storage/logs/
和.ENV文件
链接
回答by Safak Ciplak
do you have .env file
你有 .env 文件吗
in terminal
在终端
cp .env.example .env
php artisan key:generate
chmod 777 -R storage
回答by Safak Ciplak
you must execute these commands
你必须执行这些命令
php artisan key:generate
php artisan config:cache
if it doesn't work
your .env file replace with APP_KEY=base64:jxfiwITVfhauwt6clRR2plSXNg+KHlDbgIUQYIXvkVI=
如果它不起作用你的 .env 文件替换为 APP_KEY=base64:jxfiwITVfhauwt6clRR2plSXNg+KHlDbgIUQYIXvkVI=
回答by Site Antipas
I face the same issue with Laravel 5.8
but it was online. The way to resolve was to create a .env
file which was missing after I transferred it from localhost. Also transfer all it's content into the new .env
file.
我在 Laravel 上遇到了同样的问题,5.8
但它是在线的。解决的方法是创建一个.env
文件,该文件在我从本地主机传输后丢失。还将其所有内容传输到新.env
文件中。
回答by Ahmed Numaan
In my case .env file was added in .gitignore so that's why when I cloned my Git repository on server I didn't get it there so that was the root cause why I was getting 500 error on server without any clue or error log. So the issue was fixed by uploading .env file on server -OR- removing .env entry in .gitignore file the committing it in Git repository before taking Git pull on server.
在我的例子中,.env 文件被添加到 .gitignore 中,这就是为什么当我在服务器上克隆我的 Git 存储库时我没有把它放在那里,这就是我在没有任何线索或错误日志的情况下在服务器上收到 500 错误的根本原因。因此,问题是通过在服务器上上传 .env 文件 - 或 - 删除 .gitignore 文件中的 .env 条目,在将 Git 拉到服务器上之前将其提交到 Git 存储库中来解决的。
回答by San K
Please check following things 1. Composer update /install 2. Check storage folder has correct permission
请检查以下事项 1. Composer 更新/安装 2. 检查存储文件夹是否具有正确的权限
And other steps mentioned in above reply.
以及上面回复中提到的其他步骤。
回答by ador jahin
Refactor the file name .env.example to .env which could found in the root directory . Then check in that file APP_debug =true . If that's okk then open cmd and php artisan key:generate
将文件名 .env.example 重构为可以在根目录中找到的 .env 。然后签入该文件 APP_debug =true 。如果没问题,然后打开 cmd 和 php artisan key:generate
Then again start the server .
然后再次启动服务器。
回答by Dilip yadav
You must try this:
你必须试试这个:
php artisan key:generate **strong text**
and give the 777 permission for this project.**strong text**
then run php artisan serve
command.
并给这个777的权限project.**strong text**
,然后run php artisan serve
命令。