I am trying to install drupal 8.1 on a CentOS linux machine as root user. I am getting "The directory sites/default/files is not writable." error. Before that, I had to manually create the sites/default/files folder. I have even changed the permission to 777 for all files and folder in "sites" and its sub folders and 'root' is owner of all files and folders/subfolders.

-rwxrwxrwx. 1 root root 5997 Apr 27 05:28 default.services.yml
-rwxrwxrwx. 1 root root 29105 Apr 27 05:28 default.settings.php
drwxrwxrwx. 2 root root 6 Apr 27 05:45 files
-rwxrwxrwx. 1 root root 29105 Apr 27 05:40 settings.php

How can I fix this issue?

  • Maybe there are some access restrictions on the Apache (or nginx) user writing to the directory even with the 777? – mradcliffe Apr 27 '16 at 13:50
  • Is selinux running? Check ls -Zon these directories. – cilefen Apr 27 '16 at 14:59

Install the drupal using virtual host, it will be help to manage all the permissions.
Here i'm giving an example of a virtual host file with some permissions which might help you install the site.

    <Directory "/var/www/html/mysite">

    Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
        Allow from all


    ServerName mysite.local
    ServerAlias www.mysite.local
    DocumentRoot /var/www/html/mysite
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

| improve this answer | |

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.