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.
相关问题
- Why doesn't php sleep work in the windows-subs
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
- Installing Pydev for Eclipse throws error
- convert logback.xml to log4j.properties
相关文章
- 为什么nfs在不同版本的Linux下安装的文件都不一样
- how do I log requests and responses for debugging
- Android Studio doesn't display logs by package
- Incompatible JavaHl library loaded
- Python - Node.js (V8) runtime is not available on
- Stacktrace does not print in Glassfish 4.1 Cluster
- Laravel 5 input old is empty
- Out of curiosity — why don't logging APIs impl
The permissions for the
storage
andvendor
folders should stay at775
, 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 instorage
.All you need to do is to give ownership of the folders to Apache :
Then you need to add your computer (referenced by it's
username
) to the group to which the server Apache belongs. Like so :Most frequently,
groupName
iswww-data
but you might want to replace it with your correct group.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 byphp artisan something
command (case 2), log file will havepermissions.
If it was created by your apache server (case 1), which ussually launch under
www-data
user, permissions will look like this:So, my suggestion is to change permissins for newly created files by apache.
Let's add line
umask 000
to/etc/resolv.conf
file.Now,
That's it.
Be aware, this solution is applicable for development environment only, due the possible secutity risk.
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