Created
October 6, 2020 21:06
-
-
Save Kristjan-Reinsberg/707a48fca4fd814541671d3e4fad686e to your computer and use it in GitHub Desktop.
LARAVEL STORAGE LINK IN SHARED HOSTING
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| #Please note that project folder is one level from public_html (/../projects/laravel/) | |
| #Plese note that laravel public folder files must be in public_html (configure the location) | |
| #1 Remove storage folder in public_html/public/storage if you perfomed storage:link in local | |
| #2 Create a php file: mysymlink.php @ public_html folder | |
| #3 Add below codes to mysymlink.php file | |
| $targetFolder = $_SERVER['DOCUMENT_ROOT'].'/../projects/laravel/storage/app/public'; | |
| $linkFolder = $_SERVER['DOCUMENT_ROOT'].'/storage'; | |
| symlink($targetFolder,$linkFolder); | |
| echo 'Symlink @ Cpanel type virtual host completed (var_dump to be sure)'; | |
| /* NOT SURE ABOUT PATH? Test like so. | |
| @public_html folder run this in some file: | |
| $target_folder = $_SERVER['DOCUMENT_ROOT'].'/../projects/laravel'; //go one back from public_html | |
| $files_in_folder = scandir($targetFolder); | |
| print_r($files_in_folder); | |
| */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are saving my Life!
So Thanks man :)