I have Ubuntu and Laravel 5 framework and I see the white screen in the browser.
When I change storage/logs
directory permissions it helps, but I have to do it every day, due the 'daily' log configuration.

- 2,672
- 3
- 27
- 26
5 Answers
The permissions for the storage
and vendor
folders should stay at 775
, for obvious security reasons.
However, both your computer and your server Apache need to be able to write in these folders. Ex: when you run commands like php artisan
, your computer needs to write in the logs file in storage
.
All you need to do is to give ownership of the folders to Apache :
sudo chown www-data:www-data /path/to/your/project/vendor
sudo chown www-data:www-data /path/to/your/project/storage
Then you need to add your computer (referenced by it's username
) to the group to which the server Apache belongs. Like so :
sudo usermod -a -G www-data userName
Most frequently, groupName
is www-data
but you might want to replace it with your correct group.

- 8,523
- 9
- 50
- 67
-
1Unfortunattely, your approach wouldn't help. By default Apache creates new files with permissions 644 (-rw-r--r--). It means artisan can't write to the same file whether it belongs to the www-data group or not. – alexeydemin Jun 18 '15 at 16:22
-
1You are right. I will delete my answer. However, you should consider adding the user to the www-data group and keeping 775, rather than 777 all the folder. We need a solution that works for production too. – BassMHL Jun 19 '15 at 16:54
I got the same error. By using the following command I could solve it. For some reason, it is not about the log file.
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

- 3,818
- 13
- 49
- 64
-
-
Could you please explain why those commands solved the issue? It also worked for me. – Daniel Soublett Aug 29 '19 at 02:05
- chmod 777 is in general a security risk extremely risky.
chmod 775 for the storage folder is fine considering user also
belongs to web server group.with -R its extremely risky since for files an execute permissions is not at all required.
chmod 664 for files inside storage. chmod 775 for folders inside

- 339
- 1
- 6
In config/login.php
, check permissions are set:
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
'permission' => octdec('0666'),
],

- 2,672
- 3
- 27
- 26

- 91
- 1
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 04 '22 at 17:45
Short answer:
sudo chmod -R 777 vendor storage
echo "umask 000" | sudo tee -a /etc/resolv.conf
sudo service apache2 restart
Extensive answer:
When you launch Laravel 5 framework on Apache server with enabled by default 'daily' option for creating log files, sometimes you would face with forbiddance of writing into logfiles due the file permissions.
Ususally, when you have php project all files belong to www-data
user, and your current user has no need to write to logfiles.
Regarding the Laravel, two different processes need to write to your logfiles:
1) Apache server (user www-data
) when you do something in your browser;
2) Php process (your user) when you execute php artisan something
in command line.
Of course, you can execute sudo -u www-data php artisan your_command (like suggested here ) each time you want to use artisan, but it is a bit annoying.
First of all you need to give permissions to vendor and storage directories for Apache user.
Most easiest way (but not the best one) is to perform:
sudo chmod -R 777 vendor storage
Now, lets see what happens when logfile creates in both cases.
If initially logfile storage/logs/laravel-2015-mm-dd.log
was created through the error raised by
php artisan something
command (case 2), log file will have
`-rw-rw-r-- your_user:your_user`
permissions.
If it was created by your apache server (case 1), which ussually launch under www-data
user, permissions will look like this:
-rw-r-r-- www-data:www-data
So, my suggestion is to change permissins for newly created files by apache.
Let's add line umask 000
to /etc/resolv.conf
file.
echo "umask 000" | sudo tee -a /etc/resolv.conf
Now,
sudo service apache2 restart
That's it.
Be aware, this solution is applicable for development environment only, due the possible secutity risk.

- 2,672
- 3
- 27
- 26
-
1
-
4What to do in production environment? For example, on DigitalOcean? What to do for Nginx? For example, on DigitalOcean LEMP? – Debiprasad Jul 31 '15 at 15:42
-
-
3This is terrible, terrible advice. Do NOT follow this. First off, /etc/resolv.conf has *nothing* to do with file permissions. If you are crazy, you can set the default umask in /etc/login.defs for a common Linux system using pam_umask. Another common place to put it is /etc/profile, or even /etc/rc.local. Still, you should *not* do this. Security is important, even on a dev system. – hackel Dec 08 '15 at 18:11
-
2Some of the posters are being rude to you. You brought up a key concept not thought of by other posters in that Artisan and web traffic can be sourced from different users. This caused huge problems in my case. My scheduler ran artistan every five minutes...but as root. So my log file would rotate to root, then when a web request tried to write to the log it crashed the system. I fixed this by making sure my crontab command for artistan scheduler was executed as the web user...not root. Thank you! – user2662680 Apr 12 '18 at 14:25