-2

I just installed a bare boned Drupal 10 locally. and Windows 10 with PHP 8.1.14

I set the private file path as follows:

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

Its path shows correct "/admin/config/media/file-system". Now when I went to Drupal status page, it shows

Warning: file_exists(): Unable to find the wrapper "private" - did you forget to enable it when you configured PHP? in Drupal\Component\FileSecurity\FileSecurity::writeFile() (line 152 of core\lib\Drupal\Component\FileSecurity\FileSecurity.php).

I applied the security code for the .htaccess file, but still showing this

enter image description here

Then I added a code snippet in the theme preprocess function like this:

if(file_exists('private://.htaccess')) {
    print 'I found it<br>';
}
else {
    print 'It does not exists<br>';
}

It always shows file does not exists. But of course file is there.

I did not face this issue in previous Drupal versions. Btw, in my php.ini allow_url_fopen is On and opessl is enabled.

Anyone there to help me to fix this issue?

4
  • Can you confirm you followed all directions, including clearing the caches? git.drupalcode.org/project/drupal/-/blob/11.x/sites/default/…
    – cilefen
    Sep 3 at 21:27
  • yes, directories are there and cleared cache several times. Sep 4 at 7:54
  • According to what is in the Question this should be working. So the Question needs more information. You’ve missed something on your end.
    – cilefen
    Sep 4 at 11:29
  • Welcome to Drupal Answers! To add to what @cilefen said, it is not clear what Its path shows correct "/admin/config/media/file-system" would mean. /admin/config/media/file-system is the path for the File system settings page, which eventually would show the private file system path. The problem is not that path, but the fact that for PHP private:// is not defined as stream wrapper.
    – apaderno
    Sep 5 at 7:20

1 Answer 1

0

I could not say what happened. But reinstalling the Drupal dump fixed the problem.

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