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

quickee's avatar

Issues - with the public folder symbolic link

any ideas on what could be the issue? Laravel 10 - ubuntu docker / sail

//creating the link seems to work
php artisan storage:link
//i can see the folder inside 
app
 public
  storage
    compliance
     image.jpg

Trying to access the image in blade - resource not available

 <img  src="{{asset('storage/compliance/image.jpg')}}" >
<img  src="{{ url('storage/compliance/image.jpg')}}" >
//404
http://localhost/storage/compliance/image.jpg
//storage folders
 storage
  app
   public
    compliance
     image.jpg
  
0 likes
12 replies
Snapey's avatar

first question, what is the document root?

quickee's avatar

@Snapey

im not 100% where the root is with Docker.

the project does live inside

 ~/code/doc-manager 
Snapey's avatar

Is this an error in your question only

<img  src="{{ url('storage/compliance/image.jpg')}}" >
//404
http://localhost/storage/compliance/Untitled.jpg

image.jpg versus Untitled.jpg

quickee's avatar

@Snapey sorry that was typo - error only in question, the name of the files are correct.

doc-manager
  app
  boostrap
  config
  ....
  tests
  vendor
quickee's avatar

@Snapey - I thought your meaning 'doc root' was something else than I knew it by because i put this example previously.

http://localhost/storage/compliance/Untitled.jpg
http://localhost/manage-items
Snapey's avatar

@quickee yes, you put http://localhost/storage/compliance/Untitled.jpg but you are saying this does not find your image which would make sense if your page was at http://localhost/public/manage-items for instance

quickee's avatar

@Snapey understood. here is a working example

//this works
localhost/images/image.jpg
//this does not work
localhost/storage/compliance/image.jpg
//file structure
app
 public 
  -images - not symlink
   --image.jpg
  -storage - symlink
   --compliance
    ---image.jpg
  
quickee's avatar

@Snapey still unsuccessful - see the results and changes made below

//public
drwxr-xr-x 3 user user 4096 Apr 17 17:06 images
lrwxrwxrwx 1 user user   81 Apr 17 14:12 storage
//public/storage
drwx------ 2 user user  4096 Apr 17 14:43 compliance

//inside public/images - works
-rw-r--r-- 1 user user 7443 Apr 17 17:06 image.jpg
//inside public/storage/compliance/ -doesn't work
-rw-r--r-- 1 user user 7443 Apr 17 14:01 image.jpg

//changes made - matched the compliance to public/images
 //public/storage/compliance
 //old
 drwx------ 2 user user  4096 Apr 17 14:43 compliance
 //new 755
 drwxr-xr-x 2 user user  4096 Apr 17 14:43 compliance
 //also added  777 to everything /storage & /storage/compliance - still  unsuccessful

quickee's avatar

bump - still having this issue please!

Phil_Dr's avatar

@quickee This happened to me once, and I solved the problem by adding some permissions to the filesystems file under the config folder:

'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
            'throw' => false,
            'permissions' => [ 
                'file' => [
                    'public' => 0644,
                    'private' => 0600,
                ],
                'dir' => [
                    'public' => 0755,
                    'private' => 0755,
                ],
            ],
        ],

This is not safe if you have private files.

In my case, there were only some images for display, and I wasn't sure what caused the problem. It didn't occur in any other project, but I think that it was related to the reserved hosting.

Hope This helps.

Please or to participate in this conversation.