Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0-beta4
Description: 

In Drupal 7, it was possible under admin/config/media/file-system to set the "Private file system path". This setting is no longer available from the UI in Drupal 8.

In Drupal 7, it was also possible to change this by setting $conf['file_private_path'] in settings.php. In Drupal 8, it is now called $settings['file_private_path'].

Getting the path to the private files folder

Earlier versions of Drupal 8

$private_path = \Drupal::config('system.file')->get('path.private');

Since Drupal 8.0.0-beta4

use Drupal\Core\StreamWrapper\PrivateStream;
$private_path = PrivateStream::basePath()

Note that if you are migrating to Drupal 8, this path must be configured in settings.php prior to running the migration.

$settings['file_private_path']  = 'path/to/the/private/files/directory';

We highly recommend that you rebuild the cache after touching this particular setting, for example by running drush cr on the command line.

Impacts: 
Site builders, administrators, editors
Module developers