Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cboxdk's avatar

UNC Path as local filesystem

I have an application which needs to run on windows due to some dependencies here.

I have to use my fileservers as storage either as a mounted drive or a UNC path. Both should work on the server. However i can't make it work in Laravel as a local filesystem.

If a add it as W:\ i get an error with the message: The root path W: is not readable.

If i add it as a UNC path like "\\storage\share" it creates the folder in C:\storage\share and usses this as the prefix.

As i'm bound to use either a mounted drive or UNC there's no reason to suggest other types of storage. I do know how to use other types but it simply can't be used here.

Any ideas on a solution is much appreciated. :)

0 likes
8 replies
Snapey's avatar

What web server are you using? When your PHP code runs, who's account is it using to access the fileshare - does that user have rights to see the share?

cboxdk's avatar

It's CLI jobs running under an account with full access to the drives. I even tried to setup a drive with no authentication to ensure this wasn't the issue.

I have also tested by running the commands manually in tinker with the same results.

cboxdk's avatar

Just to show that PHP is able to communicate with the storage, but not through Laravel filesystem:

>>> Storage::disk('shared')->allFiles();
LogicException with message 'The root path W: is not readable.'

>>> scandir("w:");
=> [
     ".",
     "..",
     "teams",
   ]

>>> scandir("\\\\storage\\share");
=> [
     ".",
     "..",
     "teams",
   ]
  
Snapey's avatar

What is the config for your shared disk?

It may be that flysystem is not Windows share compatible, whereas raw php is ok.

cboxdk's avatar

Yeah that's what i'm trying to find out really.. Will it just not work or is there a workaround, parameter whatever which solves the issue.

Config is like:

'shared' => [
    'driver' => 'local',
    'root' =>  'w:\',
],

or


'shared' => [
    'driver' => 'local',
    'root' =>  '\\storage\shared',
],

or

'shared' => [
    'driver' => 'local',
    'root' =>  '\\\\storage\\shared',
],

or


'shared' => [
    'driver' => 'local',
    'root' =>  '//storage/shared',
],
cboxdk's avatar

It seems to be an issue with the is_readable() function in PHP. It's used in flysystems Local adapter in the constructor.

https://github.com/thephpleague/flysystem/blob/master/src/Adapter/Local.php

There's a couple of PHP bugreports about the issue, but as far as i can see no fixes.

https://bugs.php.net/bug.php?id=49620 https://bugs.php.net/bug.php?id=62199 http://stackoverflow.com/questions/10818770/php-is-readable-fails-on-readable-samba-directory

matbeard's avatar

Hi cboxdk

Did you get anywhere with this? I'm in exactly the same situtation (though I've made some progress with the use of Windows symbolic links).

cboxdk's avatar

@matbeard Not really. I decided on another approach as it didn't work well.

Please or to participate in this conversation.