@dohisev try
chmod 777 /storage/logs/laravel.log
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I just installed Laravel on a centos server and it doesn't work due the permissions. I was wondering how to solve this?
@dohisev try
chmod 777 /storage/logs/laravel.log
I was reading that 777 isn't safe so that is why I came here to ask you guys about that... and also reading the docs it says that I need permision on storage folder and bootstrap or something like that.
check this thread https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security
and don't use 777
I saw that thread and tried to run the commands but most of them the server says invalid user for chown and invalid group for chgrp.
I think CentOS uses 'apache' for group ownership, not 'www-data'
chgrp: invalid group: 'apache'
you should not need to change ownership of anything, just concentrate on permissions.
Delete any Log file that already exists in case it is not owned by the webserver
The only permission that works is setting 0777 to storage, other than that doesn't work.
Could also be selinux that makes it impossible to write to the log file.
See https://linuxhint.com/how-to-disable-selinux-on-centos-7/
Try this inside your project folder
sudo chown -R $USER:www-data storage sudo chown -R $USER:www-data bootstrap/cache
Fixed my problem with this command in centos 7.6 Server
chcon -R -t httpd_sys_content_t $SITE_PATH
chcon -R -t httpd_sys_rw_content_t $SITE_PATH
worked in fedora and centos
These commands were helpful:
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Mostly in ubuntu changing ownership to www-data and 775 permission solve this problem. But in centos this seems not enough. So you can run below command your projects root directory:
sudo chmod -R gu+w storage/
sudo chmod -R guo+w storage/
sudo chmod -R gu+w bootstrap/cache/
sudo chmod -R guo+w bootstrap/cache/
@HamidNE Such a post it's too old but you helped me a lot thank you so much. For RHEL distros, I have been using Ubuntu for quite a while. When I switched to Fedora, I was unaware that SELinux was enabled by default, which has restrictive policies unlike Ubuntu, so such commands were mentioned about adjusting SELinux to allow Apache to read and write to specific locations.
Please or to participate in this conversation.