Paolo Resteghini
Paolo Resteghini

Reputation: 432

Laravel / VirtualBox / Mac permissions error

I am running debian on my virtualbox on my Macbook Pro.

When building my Laravel application - I have set my permissions locally to be 777 on public, storage and bootstrap.

Every time I logout / in I then get another permissions error:

enter image description here

My mount permissions are:

sudo mount -t vboxsf -o auto,exec,rw,uid=1000,gid=33 BASE ./BASE

Can anyone advise what I need to do to fix this? I've tried sticky bit, but no joy.

Thanks

Upvotes: 1

Views: 156

Answers (3)

user1204214
user1204214

Reputation: 85

from the cheap seats, this sequence of code works for me each time I mess up my laravel permissions. You can use the script and update the variable or just find replace with your info for each command

#!/bin/bash
#set local variables
fullpath=/path/to/your/laravelproject
localuser=yourlocalusername

#make sure your local user is in the apache group
sudo usermod -a -G www-data $localuser

#give ownership of directory to apache group
sudo chown -R www-data:www-data $fullpath

#set all files to 644 and directorys to 755
sudo find $fullpath -type f -exec chmod 644 {} \; 
sudo find $fullpath/ -type d -exec chmod 755 {} \;

#chown a bunch more to make sure it knows you mean business
sudo chown -R www-data:www-data $fullpath
sudo chown -R www-data:www-data $fullpath/
sudo chown -R $localuser:www-data $fullpath/

#move into laravel project directory
cd $fullpath/

#give apache group ownership and write to storage and cache
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

#give local user and apache group ownership and write to storage and cache
sudo setfacl -Rdm u:$localuser:rwx,u:www-data:rwx storage
sudo setfacl -Rm u:$localuser:rwx,u:www-data:rwx storage

#set artisan back to executable
sudo chmod +x artisan

#rebuild npm because it gets mad
npm rebuild

Upvotes: 0

rüff0
rüff0

Reputation: 943

try with

./artisan cache:clear

after the recursive chmod command was inserted

Upvotes: 0

Ohgodwhy
Ohgodwhy

Reputation: 50787

777 on storage does not mean 777 on storage/framework/sessions.

CHMOD the following directories to 0777 as well: storage/framework/sessions and storage/framework/cache

Upvotes: 1

Related Questions