19

I have searched this issue on internet but none of them helped me. Also this one doesn`t:

chgrp apache /path/to/mydir
chmod g+w /path/to/mydir

My server is centos 7. Can you help me?

Shaig Khaligli
  • 4,955
  • 5
  • 22
  • 32

6 Answers6

45

Try with following commands:

  1. This will give you the name of apache user.
    ps -ef | grep apache | grep -v grep

    In most of the cases the user will be www-data.

  2. Run these command after going into the /frontend/web folder:
    sudo chgrp www-data ./assets
    and
    sudo chmod g+w ./assets/

Your problem will be solved.

Sam
  • 925
  • 1
  • 12
  • 28
16

I have the problem too (in CentOS7). I tried to change the owner and group, but it didn't work. Finally, I closed the selinux, and it work.

setenforce 0

If you want to close it forever, you can change the /etc/selinux/config file:

SELINUX=disabled
lizs
  • 540
  • 2
  • 8
  • 18
6

i have same issue in ubuto instance i did like that and issue solve

sudo chmod 777 /home/nicjccom/public_html/asset

and also did this

sudo chgrp root /home/nicjccom/public_html/asset
Adiii
  • 54,482
  • 7
  • 145
  • 148
1

You can try this:

chcon -R -t httpd_sys_content_rw_t 'YOUR_PATH_HERE'
Dino
  • 7,779
  • 12
  • 46
  • 85
0

Try the following command

I am giving permissions to html folder in www.My html folder contains multiple projects.

chgrp -R user html/
chmod -R g+w html/
chmod -R g+w html/
Amol
  • 363
  • 2
  • 12
0

If you're use php-fpm v7.4 and all your user/group are correct. you can use

systemctl edit php-fpm

[Service]
ReadWritePaths = /usr/share/webapps/yii2-basic/web/assets

and add above config,then

systemctl restart php-fpm

hx_hxl
  • 95
  • 2
  • 2