databaselaravelcontrollerco

How to solve permission problem in laravel


I've got problem about laravel permission. I'm trying to retrieve data from database using laravel. But on my page, I am getting this error message:

UnexpectedValueException thrown with message "The stream or file "/var/www/html/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied"

Route codes:

Route::get("sumo", "PagesController@sumos");

Controller codes:

public function sumos()
{
  $data['este'] = estates::all();
  return view('pages.sumo', $data);
}

and mypage's code:

@foreach($este as $row) 
{{$row->価格}}
{{$row->間取り}}
{{$row->販売戸数}}
{{$row->総戸数}}
{{$row->専有面積}}
{{$row->専有面積}}
{{$row->その他面積}}
{{$row->'所在階/構造 階建'}}
{{$row->完成時期}}
{{$row->住所}}
@endforeach 

I also tried to give "sudo chmod -R 775 storage" and restart the httpd but no effect on it. I am using Centos 7 Apache. How can I overcome this problem. My codes is wrong or something?


Solution

  • Did you try?

    sudo chown www-data.www-data /var/www/html/laravel/storage/ -R