I'm using vagrant with precise64 box & a Laravel 4 project. I've set Storage folder to be writable (777 only works for me) and every time a new file created, session for example, I need to manually set yet again the new file to be writable.
Is there any option to set newly created files to be writable in order to prevent this kind of issue in the future?
edit: Here is an example of ll -la output on the session folder containing new session (done from the vagrant box), maybe it'll help.
vagrant@precise64:/myfinalproject$ ll -la ./app/storage/sessions/
total 16
drwxrwxrwx 1 vagrant vagrant 4096 Jul 9 04:29 ./
drwxrwxrwx 1 vagrant vagrant 4096 Jun 10 12:57 ../
-rwxrwxrwx 1 vagrant vagrant 13 Jun 10 12:57 .gitignore*
-rw------- 1 vagrant vagrant 229 Jul 9 04:29 sess_u8ov414cgie6v3afmkgn3net33
The chmod command enables you to change the permissions on a file. You must be superuser or the owner of a file or directory to change its permissions.
755 - owner can read/write/execute, group/others can read/execute. 644 - owner can read/write, group/others can read only. Some directory permission examples: 777 - all can read/write/search.
I was having a very similar, possibly the same, permissions issue. I could view the site once and then all requests after would result in a permission error.
Try adding the following code to your VagrantFile:
# Set the ownership of the app/storage directory
config.vm.synced_folder "app/storage", "/vagrant/app/storage", :owner => 'www-data', :group => 'www-data'
Hopefully that helps you. The following source provided me with the solution: https://github.com/experience/vagrant-laravel-application/blob/master/Vagrantfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With