Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel storage link in shared hosting

im having problem with setting up storage link on shared hosting. Because of that I can't upload any image to storage folder in shared hosting

like image 381
AlViyan Badro Kamali Avatar asked Jun 19 '19 06:06

AlViyan Badro Kamali


1 Answers

  1. Remove storage folder in public_html/public/storage if you perfomed storage:link in local

  2. then Create a php file for example mysymlink.php in public_html folder

  3. Add below code to mysymlink.php file

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
symlink($targetFolder,$linkFolder);
echo 'Symlink completed';
  1. Go to web site example.com/mysymlink.php
like image 194
Yann Boyongo Avatar answered Oct 15 '22 13:10

Yann Boyongo