How to fix Warning: is_writable(): Unable to find the wrapper "private"?
https://www.zyxware.com/sites/default/files/styles/user_image/public/default_images/index.png?itok=dkp9qUXZ
BY Sulfikar S
1 week ago
-Drupal-8

If you are a Drupal programmer, you might have encountered a weird warning, seen here in the headline. This warning will appear if you have not set the 'private file system'. In Drupal 8, you can no longer set 'private file systems' via UI. You do it using your settings.php file.

Here are the steps to fix this:

Create a folder on the project. It must exist outside of your webroot directory and be an absolute path, for example:

/var/www/html/example.org/private with webroot in /var/www/html/example.org/web

or

/home/username/example.org/private with webroot in /home/username/example.org/web.

mkdir private

Then, search for this line in your settings.php:

# $settings['file_private_path'] = '';

Uncomment the line and add the path of the folder thus created like below:

$settings['file_private_path'] = $app_root . '/../private';

Clear the Drupal cache, for example with drush cr or by going to the page:

/admin/config/development/performance

from your browser.

In the browser's address bar, go to /admin/config/media/file-system. You should see "Private local files" in the "Default download method" option. If not, please visit the /admin/reports/status page to see any error messages. Make sure that PHP can write in the directory. Often, for this to work, the directory has to be writable for the www-data user. If so, create the folder for private like below:

sudo -u www-data mkdir -p private

Reference:


RELATED ARTICLE