Home >Backend Development >PHP Tutorial >The log permission in laravel has inexplicably changed to root
The framework uses laravel, which writes some data to the log and saves it to the storage directory. It looks normal at first, but after a while, the file permissions automatically change to root permissions, causing laravel with only www permissions to not be able to write. In the log, is this really a weird situation?
There is only one logstash that operates on the log file, which is used to read and create visual logs regularly, and there is nothing else
The framework uses laravel, which writes some data to the log and saves it to the storage directory. It looks normal at first, but after a while, the file permissions automatically change to root permissions, causing laravel with only www permissions to not be able to write. In the log, is this a weird situation?
There is only one logstash that operates on the log file, which is used to read and create visual logs regularly, and there is nothing else
It may be that you used the root command to execute the artisan command. For example, if a scheduled task is executed as the root user, a root log file will be generated.
chown -R www:www /path/to/laravel/storage
, in this case, even root can read and write without any problem, and www can also read and write normally.
Are there any scheduled tasks executed by the root
account
You should have used sudo php artisan xxx:xxx
I have encountered this too
Check whether php is running as Root.