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

lara28580's avatar

Symlink doesn't work in production

I try to upload images to my public folder but somehow in production it does not work. The image is saved to the storage/company folder but I cant access it in the public folder of my app.

filesystem.php

'links' => [
        public_path('storage') => storage_path('app/public'),
        public_path('company') => storage_path('app/company'),
    ],

service class

public function uploadFile(UploadedFile|File $logo): ?String
    {
        return Storage::putFile('company/logos', $logo);
    }

I also ran the php artisan storage:link in forge but no success. Maybe someone could help here?

0 likes
15 replies
Sinnbeck's avatar

Start by checking on the server if the symlink has been created. You can also try deleting the directory in /public/storage, and running php artisan storage:link again

lara28580's avatar

@Sinnbeck It says symlink has been created. Also deleted the storage folder no success.

The strange thing locally everything works just fine.

Sinnbeck's avatar

@SmokeTM Check it manually on the server. Make a file in the /storage/app/public folder and see if it shows up in /public/storage

lara28580's avatar

@Sinnbeck ok thats strange the public folder works but not the company folder.

Has that something to do with the rights?

lara28580's avatar

@Sinnbeck I mistakenly deleted the app/storage folder. Is it possible to restore them somehow? Command or something?

Sinnbeck's avatar

@SmokeTM on production? You need to restore your backup of the folder. If it's shared hosting maybe they have backups

lara28580's avatar

@Sinnbeck I reinstalled everything now but storage link doesn't work anyways. Don't know what to do now? Yes on production.

Sinnbeck's avatar

@SmokeTM so only one of them is created? Does it work locally? Laravel version?

lara28580's avatar

@Sinnbeck yes it looks like so. It works perfectly fine locally. Laravel version is 9.24.0

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@SmokeTM ok so the folders are removed in /public but are present in /storage? You run the link command and both folders show up in /public?

1 like
lara28580's avatar

@Sinnbeck It works now thank you so much!! Deleted company and storage folder in public and ran the storage:link command, now it works.

Please or to participate in this conversation.