6

This is my first time installing Drupal on CentOS. I know for Ubuntu it needs to be www-data as the /files folder owner, but what is it for CentOS?

enter image description here

6

I faced with this issue before, it was because of SELinux on CentOS, So you should try to Disable SELinux on Centos

From the command line, you can edit the /etc/sysconfig/selinux file. This file is a symlink to /etc/selinux/config. The configuration file is self-explanatory. Changing the value of SELINUX or SELINUXTYPE changes the state of SELinux and the name of the policy to be used the next time the system boots.

[root@host2a ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

Change it from SELINUX=permissive to SELINUX=disabled

Once you have saved the changes sudo shutdown -r now to restart now.


Also you can disable it temporary ( until next restarting ) with

sudo setenforce 0

How to Disable SELinux

  • OMG, big thank you. I've been going around in circles for 2 hours. – No Sssweat Dec 19 '16 at 12:35
  • For future readers: You still need apache as owner/group as per @yogesh answer – No Sssweat Dec 19 '16 at 12:38
  • 1
    @NoSssweat you're welcome my friend, I remember I spend some hours to find this solution and now I transmit it to you. 😊😊. we are here to help each others. – Yusef Dec 19 '16 at 12:40
2

In CentOS, Apache/HTTPD username is normally apache. During installation, apache user should have read-write access to sites/default directory.

After installation, apache user should have read-write access to the sites/default/files directory. Check Drupal Docs for more details on file permissions.

Note: If giving permissions doesn't help, make sure SELinux is disabled. Check @zhilevan's ans above.

  • I changed it to apache and even gave it 777 (for testing purposes) and still getting the same file system error. – No Sssweat Dec 19 '16 at 11:37
  • Did you tried with 'Proceed with the installation' or just refreshed the page? – Yogesh Dec 19 '16 at 11:43
  • If giving permissions to sites/default directory doesn't work, then try creating files directory and settings.php file inside it and giving these permissions. That should work – Yogesh Dec 19 '16 at 11:44
  • I did that while the settings file error is now gone, the file system error is still showing up. – No Sssweat Dec 19 '16 at 11:49
  • What is the error you're getting now? – Yogesh Dec 19 '16 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.