Laravel giving 500 internal error on centos 7 with apache and php 7

你。 提交于 2019-12-11 00:58:43

问题


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

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#pretty-urls

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

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');
});

to

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

It shows welcome message but for

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

getting 500 internal error in console and blank page appears.

httpd Error log


回答1:


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>

Step 2: And disabled SELinux permanently. Click here




回答2:


As your error log file shows , there are a permission issue in writing log files .

you may try :-

1- disable logging , or in other words disable Monolog package "Unrecommended"

2- tracking your error logs shows as said that there are a permission issue in writing logs , as you said :-

folder rights to storage and bootstrap is set to 777

so please make sure that you've changed the storage directory permission to 777 recursively



来源:https://stackoverflow.com/questions/42385659/laravel-giving-500-internal-error-on-centos-7-with-apache-and-php-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!