If there is an error when running php artisan
command the log file will be created like this:
-rw-rw-r-- 1 user www-data 2,2K Jul 28 18:08 laravel-2019-07-28.log
If there is an error when using app through web browser the log file will be created like this:
-rw-r--r-- 1 www-data www-data 2,2K Jul 28 16:10 laravel-2019-07-28.log
After www-data has created the original file and if there is an error with php artisan
command,
it will throw an error Permission denied
because it can't write to the log
Is there a way to set default chmod for NEW created files, so that they always have rw
for group
Or you guys have some other solution for this
To reproduce this problem:
- delete all storage/logs/*.log files
- call some non existing php artisan command for example:
php artisan make:xy
-> this will make an error and create a .log file - call route in browser /logout -> this will try to write in that same log file and will throw an error that it can't write into log 'Permission denied'
sudo -u www-data php artisan
don't you think so?