Friend
Friend

Reputation: 1346

Laravel file permission error

I am getting an error even after setting permission to 777...

ls -al /var/www/html/supervisory/app/storage
total 32
drwxrwxrwx.  7    777 apache 4096 Apr 16 00:06 .
drwxr-xr-x. 12 apache apache 4096 Apr 16 00:06 ..
drwxrwxrwx.  2    777 apache 4096 Apr 16 00:06 cache
-rwxrwxrwx.  1    777 apache   17 Apr 16 00:06 .gitignore
drwxrwxrwx.  2    777 apache 4096 Apr 16 00:06 logs
drwxrwxrwx.  2    777 apache 4096 May 26 14:47 meta
drwxrwxrwx.  2    777 apache 4096 Apr 16 00:06 sessions
drwxrwxrwx.  2    777 apache 4096 Apr 16 00:06 views

Iam getting an error on the homepage...

ErrorException

file_put_contents(/var/www/html/supervisory/app/storage/meta/services.json): failed      to     open stream: Permission denied

Upvotes: 2

Views: 5557

Answers (1)

harikrish
harikrish

Reputation: 2019

make sure you have the following settings

777 permission for app/storage folder

When you give 777 make sure you do it like this

chmod -R 777 app/storage

755 permission for folders

644 for files

If the error still there check for the ownership, the user is usually www-data

you can check it by creating a file and type in the the following

<?php 
 echo shell_exec('whoami');
?>

after getting the user add the user like this

chown -R www-data:www-data 

If the error is still there try to point your virtual host to public folder, I had had this issue for shared hosting.

Upvotes: 2

Related Questions