How to create a symbolic link for laravel website in cPanel

Posted: 26-05-2019 | Views: 18638

Symlinks, short for symbolic links, are basically shortcuts to individual files or folders. One of the advantages of a symlink is that it can cross filesystems, as it references abstract filenames/directories and not physical locations.

There is a number of ways to create a symlink

1) Remove storage folder in public_html/public/storage

2) Create a php file for example symlink.php in public_html folder

3) Add codes to symlink.php file

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
echo 'Symlink process successfully completed';

4) Go to web site

That is all...


Add comment

  • vainqueur 7 months ago

    thanks, men its worked but there is a problem when the link has created the link that is created is not working: 

    public -> /domains/ 

    when I upload an image it doesn't show up.

  • Thanks

  • if you get text of above when you go {app_url}/symlink.php