简体   繁体   中英

Laravel 5.4 laravel.log permission issue

I have Laravel 5.4 installed on my Mac using Composer and MAMP Pro. The installation completed successfully, but when I try to load localhost/lsapp/public, an UnexpectedValueException error is returned. I have checked the file permissions for the storage and logs directories and both are set to 755 using the command line. It seems the log file cannot be written for some reason. Any suggestions?

Full permission denied message: The stream or file "/Applications/MAMP/htdocs/lsapp/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in StreamHandler.php (line 107)

When you go into a production environment, I'd recommend the following:

755 permissions for the /log

644 permission for the files inside

For example if you're using apache:

The user owner of the directory (www-data) can read, write and execute. The assigned group (www-data, where my user is) can read and execute, but not write. Everyone else can read and execute, but not write.

I just faced the same issue with my installation. Here's what I did to solve it:

Make sure that www-data (or your web server's user) is either the owner or group's owner of the logs directory.

Then make sure that this user have read-write-execute on that folder. On linux I used 770 for that folder. Then laravel is now working fine.

Hope that's help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM