Search code examples
phplinuxlaravelsymlinkwindows-subsystem-for-linux

Laravel 8.60.0 creates a file instead of a folder/symlink when I run `php artisan storage:link`


Image showing what php artisan storage:link creates in my public/ directory

So , I am working on a small project where I need to create a symlink to store file in the storage directory in laravel. I was previously working on windows where the same code was working fine but as I configured Laravel Sail and set it up in my WSL-2 environment, I performed my ritualistic tasks of setting up the config, creating symbolic link, I am noticing a weird behavior of running the php artisan storage:link command where it creates a file instead of a folder in my app/public folder.

It should be a clickable folder or if not clickable, atleast my IDE should show it as a directory like that of others, i.e. like public, bootstrap, database folders. Is that a problem with my WSL or some internal configuration of Laravel. On double clicking this link it shows:

Context menu opens on clicking the file

Any assistance will be greatly appreciated.


Solution

  • If you created it in wsl2, windows won't regonize it as a symlink, it's a unix symlink and not a windows "symlink" that's all.

    In WSL you're working inside a unix based filesystem and sharing your filesystem with windows.