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

kelrob's avatar

Linking Storage folder without using Artisan

Hello there!!

Please I need help in linking my storage folder manually without artisan.

I tried duplicating the folder manually in my root public directory, but it seems that I will also need to have the file uploaded both in the storage and the root directory storage.

Please How do I go around this as I know that Linking the file with artisan; there would be no need for the files also going into the root public storage.

PS:

  1. I can't run Artisan on my Server(Shared Hosting + No SSH)
  2. I am avoiding duplicates files being uploaded so as to avoid consumption of disk space on my server.
0 likes
10 replies
jlrdw's avatar

Just put the assets under public. Do you have Laravel set up correctly meaning the folder structure.

1 like
Thyrosis's avatar

If you don't have SSH access to your server, you can't create a symlink from the public directory to the storage folder. At least, not with any Control Panel i know of.

You could ask your hosting provided, possibly they can create it for you?

Alternatively, as jlrdw suggested, store your assets in the public directory.

1 like
jlrdw's avatar

You can still use the asset helper when they're stored under htdocs.

However the main laravel needs to be above public or htdocs. Some hosting this may be called public_html.

If you do not know how to properly do this add a reply for more help I have a reference as to how to set everything.

If not setup correctly there are serious security problems.

1 like
kelrob's avatar

Thanks @jlrdw and @Thyrosis . My directory structure is actually very perfect.

I think I found a way. If I can have a way of calling artisan command via code that will be very helpful.

1 like
kelrob's avatar

Thanks @Cronix. I think running the artisan via a route is my best solution at the moment which I will later remove after executing it just as you said.

But I am actually very new to Laravel :(

Is there a way you can help me with the code for the route to run the artisan here. Please.

1 like
Cronix's avatar
Cronix
Best Answer
Level 67

Its basically like the docs show...

Route::get('/foo', function () {
    Artisan::call('storage:link');
});
4 likes
kelrob's avatar

Thanks @Cronix So Much :).

I tried running it now, and i got this error.

(1/1) ErrorException symlink() has been disabled for security reasons

1 like
Cronix's avatar

Ok. Your shared hosting won't allow you to create symlinks, so you're kind of limited. You'll either have to just use the /public dir, or use an external storage solution (like AWS S3).

1 like

Please or to participate in this conversation.