Laravel使用Apache和PHP 7在CentOS 7上给出500内部错误 [英] Laravel giving 500 internal error on centos 7 with apache and php 7

查看:422
本文介绍了Laravel使用Apache和PHP 7在CentOS 7上给出500内部错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是centos的新手.我已经安装了apache和php7.我还安装了laravel所需的所有php扩展.

I am new to centos. I have installed apache and php 7. I have also installed all php extensions required for laravel.

我有一个在Windows上可以正常运行的laravel应用程序,我刚刚将我的代码从Windows转移到了centos 7,现在的问题是它在控制台上的每条路径上显示500个内部错误. 我已经更改了.htaccess代码,如下所示:

I have an laravel app working fine on windows.I have just transferred my code from windows to centos 7.The problem is now it shows 500 internal error in console on every route. I have changed .htaccess code as explained here:

https://laravel.com/docs/5.0/configuration#漂亮网址

https://laravel.com/docs/5.0/configuration#pretty-urls

存储和引导程序的文件夹权限设置为777,同时启用了mod_rewrite.

folder rights to storage and bootstrap is set to 777, also enabled mod_rewrite.

另外,当我安装新鲜的laravel时,它不起作用.当我从

Also when I installed fresh laravel its not working. When i am updating the main route in web.php from

Route::get('/', function () {
    return view('welcome');
});

Route::get('/', function () {
    return 'welcome';
});

它显示欢迎消息,但对于

It shows welcome message but for

Route::get('/', function () {
    return view('welcome');
}); 

在控制台中获取500内部错误,并显示空白页面.

getting 500 internal error in console and blank page appears.

httpd错误日志

推荐答案

步骤1: 您必须通过将.htaccess添加到您的虚拟主机中来启用它:

Step 1: You have to enable .htaccess by adding this to your vhost:

<Directory /var/www/html/yourfoldername/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

步骤2:并永久禁用SELinux. 单击此处

Step 2: And disabled SELinux permanently. Click here

这篇关于Laravel使用Apache和PHP 7在CentOS 7上给出500内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆