Home  >  Article  >  Backend Development  >  The log permission in laravel has inexplicably changed to root

The log permission in laravel has inexplicably changed to root

WBOY
WBOYOriginal
2016-08-04 09:21:421671browse

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

Reply content:

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 rootaccount

You should have used sudo php artisan xxx:xxx I have encountered this too

Check whether php is running as Root.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn