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

Nana-Odai's avatar

Image not showing after linking public to public_html (C-panel)

helly community, I upload images to sub directories inside storage/app/public. I have expample logos and users directories.

Uploads and everything works on local host after running php artisan storage:link But on live server it is not working . I am using cpanel, so I symlink the public inside my primay_folder to public_html. When i try accessing it url, it gives 404.

Link to image of the the directory https://drive.google.com/file/d/1sfzt7SCN0_wSyD8BrZBDsAHLRmZC_b5I/view?usp=sharing

What might have been doing wrong or is there best way to go about this?

0 likes
9 replies
boby's avatar

If you have terminal access to your live server, inside laravel app folder, run the same command as you did on local machine: php artisan storage:link

boby's avatar

Not working as, command fail or it didn't set link?

Nana-Odai's avatar

Link was set but the image is still not showing.

could it be how I linked the directory to public_html as I have shown in the image in the link. I runned ls -l and the public_html is shown as lrw.... and not drw...

boby's avatar

Wait, you are trying to link non-default folders on your server? What needs to be linked with what? Your images are in public_html and you want to link that folder with laravel public folder?

Did you adapt you filesystems.php file from config folder?

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],
Nana-Odai's avatar

The images are stored inside storage/app/public

boby's avatar

When you run php artisan storage:link, is there a link in public folder of your app?

Nana-Odai's avatar
Nana-Odai
OP
Best Answer
Level 1

SOLVED

It was as a result of an if condition to check the path on production or on local. everything works fine now. Thanks to @boby for an eye opening

xevorte's avatar

excuse me i just got same problem here, can you share more specific about how to fix this storage problem? thank you.

Please or to participate in this conversation.