Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create laravel storage symbolic link for production or sub domain system?

When I worked on laravel local development server php artisan storage:link works fine for me. But when I transfer my site to production server then I saw my public storage link was a folder. Then I delete that tried to create a link. I got an error because my app was in the root folder and tried to solve this problem.

like image 712
Mizanur Rahman Khan Avatar asked Aug 22 '17 19:08

Mizanur Rahman Khan


People also ask

How do I link my storage to server in Laravel?

Create a symbolic link By default, public disks use local drivers and store these files under storage/app/public . To access them via the web, you need to create a symbolic link from public/storage to storage/app/public . Next, use the command below in order to create the symbolic link.

How do I link my storage folder in Laravel 8?

In your terminal, navigate to your Laravel project folder. Now create the folder /images in your /storage/app/public folder which gives you /storage/app/public/images. Copy a test image named logo. png into the /storage/app/public/images folder.

How do I get Artisan storage link in php?

Steps: cd to your <project_root>/public directory and run rmdir storage - it will remove the link. cd back to project root directory and run php artisan storage:link to link again.

What is symlink Laravel?

Laravel Symbolic link is used to link storage/app/public directory with the public directory. The easiest way to understand Symbolic link is to think a folder shortcut which we usually create in Windows.


1 Answers

I solved this problem by another command for creating a symbolic link by terminal/cmd/shh:

ln -s /path/to/laravel/storage/app/public /path/to/public/storage 

I solved this also Using laravel web route routes/web.php

Route::get('/foo', function () {     Artisan::call('storage:link'); }); 
like image 82
Mizanur Rahman Khan Avatar answered Oct 12 '22 22:10

Mizanur Rahman Khan