Laravel permission problem

Issues related to applications and software problems
Post Reply
nbrignol
Posts: 3
Joined: 2019/06/05 15:44:07

Laravel permission problem

Post by nbrignol » 2019/06/05 15:55:32

Hi,

I have permissions problem on my Laravel installation, even when I set the appropriate rights on the "storage" folder.
Why can't Laravel create the logs directory ?

The error (web) :
There is no existing directory at "/var/www/my_project/storage/logs" and its not buildable: Permission denied

The rights :

Code: Select all

ll /var/www/
drwxrwxr-x. 14 apache apache 4096  5 juin  17:46 my_project

Code: Select all

ll /var/www/my_project
drwxrwxr-x.  4 apache apache     34  5 juin  17:40 storage
The users :

Code: Select all

groups apache 
apache : apache admin

Code: Select all

groups admin
admin : admin wheel apache
Linux : CentOS release 7.6.1810 (Core)
Apache 2.4.6

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Laravel permission problem

Post by TrevorH » 2019/06/05 16:42:09

What is the output from ls -laZ /var/www/ /var/www/storage /var/www/storage/logs
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

nbrignol
Posts: 3
Joined: 2019/06/05 15:44:07

Re: Laravel permission problem

Post by nbrignol » 2019/06/06 10:26:13

Hi

I have created a symlink for my_project => my_real_project, but I have the exact same error when I use the directory without symlink

Code: Select all

ls -laZ /var/www/
drwxr-xr-x. root   root   system_u:object_r:httpd_sys_content_t:s0 .
drwxr-xr-x. root   root   system_u:object_r:var_t:s0       ..
drwxr-xr-x. root   root   system_u:object_r:httpd_sys_script_exec_t:s0 cgi-bin
drwxr-xr-x. root   root   system_u:object_r:httpd_sys_content_t:s0 html
lrwxrwxrwx. root   root   unconfined_u:object_r:httpd_sys_content_t:s0 my_project -> my_real_project
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 my_real_project
I have created manually the storage/logs directory, and now the error is "The stream or file "/var/www/my_project/storage/logs/laravel-2019-06-05.log" could not be opened: failed to open stream: Permission denied"

Code: Select all

ls -laZ /var/www/my_project/storage/
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 .
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 ..
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 app
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 framework
drwxrwxrwx. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 logs

nbrignol
Posts: 3
Joined: 2019/06/05 15:44:07

Re: Laravel permission problem

Post by nbrignol » 2019/06/06 13:33:57

Ok I figured out. It was a chcon problem.
Don't know why it's like that, but I fixed it with

Code: Select all

sudo chcon -t httpd_sys_rw_content_t storage

Post Reply