I am trying to display my logs on my website to verified users in Laravel based on my role based access control.
$file = fopen("/var/log/auth.log", "r") or die();
$content = fread($file, filesize("/var/log/auth.log"));
fclose($file);
This hits me with an error:
fopen(/var/log/auth.log): failed to open stream: Permission denied
I can see that Laravel does not have the correct read permissions for this file and I do not what to do a typical chmod -R 777
due to security. I am using nginx
but Laravel executes with php-fpm
.
What user-group does my site execute in? What permissions should I give that user-group on my log files?
Source: Laravel