Symbolic link for local uploads folder not working

Hi there,

Since I’m managing multiple wordpress sites on my MacBook (which has limited space), I moved all my local uploads folders to an external drive and made symbolic links to them in the appropriate web/app folders.
Somehow this is not working with the blade caching, since I’m getting these errors:

Warning: file_put_contents(/srv/www/ failed to open stream: No such file or directory in /srv/www/ on line 122
Warning: include(/srv/www/ failed to open stream: No such file or directory in /srv/www/ on line 43
Warning: include(): Failed opening '/srv/www/' for inclusion (include_path='.:/usr/share/php') in /srv/www/ on line 43

I checked the folder permissions and they are the same.
I did a vagrant reload but still get the same errors…

Is this possible? And if not, can I set a custom folder path for the blade caching somewhere?

Sorry, you can set a custom cache location here:

But it turns out the symbolic link itself is not working within the vagrant box…
Is there an other way I can achieve the same thing?

Adding this line to the Virtualbox settings in the Vagrantfile:

VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root', '1']

also does not make a difference…

I’ve had trouble with symbolic links that attempt to cross the guest/host VM boundary. I’d recommend just using VirtualBox’s Folder Sync:

1 Like

Thanks! I’ll give that a try!
Although ideally I would like to have a setup where I could still run my local VM on the road without my external drive connected, but I think that won’t work with an actual synced folder?

I’m not sure that symlinks would perform any better in that situation. I’m not sure what Vagrant will do if it can’t find a synced folder: my guess would be that it boots but just doesn’t sync that folder.

You could also switch to Windows and use junctions instead of symlinks, which work fine w/ VMs. :wink:


That could work

When I come to think of it, this wouldn’t work in my case since I would need to hardcode the path to my external drive as synced folder in the Vagrantfile and I’m sharing the code with colleagues…