I'm working on getting a private folder set up on Drupal 8.6.4. It's labeled "private_files" and resides out of the site root, and I've updated settings.php to its path. File System shows the correct directory for the private directory, though its name is listed in single quotes if that matters.
The trouble is that Drupal is returning an error about this:
----
FILE SYSTEM
Writable (public download method)
The directory ‘private_files’ does not exist. You may need to set the correct directory at the file system settings page or change the current directory's permissions so that it is writable.
----
The directory most certainly does exist and File System can see it, so what is the cause of this error? Permissions?
Also, now that I've been working with this for a bit Drupal is also returning the following error:
----
PRIVATE FILES DIRECTORY
Not fully protected
See https://www.drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the directory to help protect against arbitrary code execution.
----
I read through this doc and it seems specific to D6 and D7 - nothing about how to resolve the problem in D8. Any advice?
Thanks for any help!
Comments
D8 Private Folder Issues + htaccess error
I have been having the same issue for a few months. Any experienced Drupal 8 user willing to offer simple explanation?
Thanks!
It is not that difficult.
The directory should exist in the DocumentRoot, which is where your index.php and your sites folder resides. It needs to be writable (chmod g+w) for the web server. It is preferred to specify an absolute path (/var/www/web/private_files), but a relative path to the DocumentRoot works as well (../private_files). The relative path is an example to have it above DocumentRoot. That should take care of the first error.
Copy the .htaccess from sites/default/files and append "Deny from all". Make sure to clear cache. That takes care of the second error.
Currently have /var/www/xxx and /var/www/web/sites/default/settings.php last line:
$settings['file_private_path']='../xxx';
Path
I was running into the same error but in my case only the absolute path worked with drupal10