Muhammad Shuja
Muhammad Shuja

Reputation: 672

L5.5 Create symlink between storage and public directories on shared hosting using SSH

I've setup my production server on a shared hosting my directory structure looks like this (my project is placed at same level as public):

/home/user/my-laravel-project/
/home/user/public_html

This is how I'm storing my data in Storage > Public Disc

$data->store('path/to/data', 'public');

On production, using SSH, when I run this command php artisan storage:link. It creates a symlink between storage/app/public and my-laravel-project/public I want this link to be created between storage/app/public and /home/user/public_html

What I've tried

Tried many other little tweaks but nothing works for me .. I'm looking for a proper solution to create a symlink between storage/app/public and /home/user/public_html on my shared server

Note I don't want to change paths in config/filesystems.php as that's not a proper solution

My current server is setup on Siteground with php version 7.0.32 and Laravel 5.5.43

Upvotes: 2

Views: 1923

Answers (3)

Modou S. Kebbeh
Modou S. Kebbeh

Reputation: 1

This answer from Sudaraka Senevirathne works on siteground.

Simply run php artisan storage:link on SSH terminal. It will create a symbolic file (storage) on a public folder and move it to the public_html/.

Upvotes: 0

Sudaraka Senevirathne
Sudaraka Senevirathne

Reputation: 377

Simply run php artisan storage:link on SSH terminal. It will create a symbolic file(storage) on public folder and move it to the public_html/

Upvotes: 0

utdev
utdev

Reputation: 4102

If you want to create defaults symlinks you should create one for yourself.

This is the symlink pattern:

ln -s target source

So in your case you have to do following:

ln -s /home/user/public_html storage/app/public

Upvotes: 2

Related Questions