无论如何,Fresh Laravel 5 都会显示 500 内部服务器错误(OS X、Apache)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28329658/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:50:02  来源:igfitidea点击:

Fresh Laravel 5 shows 500 Internal Server Error no matter what (OS X, Apache)

apache.htaccesslaravellaravel-5

提问by hfingler

My setup is OS X Yosemite, default Apache and PHP 5.6.

我的设置是 OS X Yosemite,默认 Apache 和 PHP 5.6。

Vhost is set correctly, I have two other apps running ok:

Vhost 设置正确,我还有另外两个应用程序运行正常:

<VirtualHost *:80>
   ServerAdmin polar
   ServerName lara5.com
   ServerAlias lara5.com
   DocumentRoot "/Users/polar/Sites/lara5/public"
   ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
   CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>

Hosts file is OK.

主机文件没问题。

I've set the permissions to 777 to the whole project folder, still nothing.

我已经将整个项目文件夹的权限设置为 777,仍然没有。

If I remove .htaccess, the splash screen shows for the url lara5.com but the /home route returns 404.

如果我删除 .htaccess,则会显示 url lara5.com 的启动画面,但 /home 路由返回 404。

I have tried both .htaccess (inside /public, ofc) Laravel provides, none of them work, 500 doesn't matter which route I access.

我已经尝试了 Laravel 提供的两个 .htaccess(在 /public、ofc 中),但没有一个可以工作,500 与我访问哪条路线无关。

Default:

默认:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Other one from the docs:

文档中的另一个:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Any ideas? Thanks.

有任何想法吗?谢谢。

采纳答案by anubhava

Translating comment into an answer to help out anyone else comes across this problem.

将评论转换为答案以帮助其他人遇到此问题。

Based on your snippet from error.logit seems that Optionsdirective isn't allowed in your .htaccess.

根据您的片段从error.log似乎Options指令不是在你的允许.htaccess

You can fix this error by commenting any line in your .htaccessstarting from:

您可以通过.htaccess从以下位置注释任何行来修复此错误:

Options


To enable use of Optionsin .htaccessuse:

要启用使用中Options.htaccess使用:

Options All

in your Apace config's <Directory>section of your DocumentRoot.

在您<Directory>DocumentRoot.