How to create a symbolic link for laravel website in cPanel

Posted: 26-05-2019 | Views: 22592
How to create a symbolic link for laravel website in cPanel

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 3 years 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

  • Is this applicable to cpanel when using GoDaddy? Thank you!

  • chosenOne 2 years ago

    is it applicable in using cpanel and godaddy?

  • thanks buddy

  • Thank you very much, please specify that you must add the "symlink" file in the view folder and go through: route-controller-view... excuse my English, I speak French

    • Can You Explain more, doesn't work for me . the CSS doesn't loaded but the image loaded perfectly

  • Thanks buddy...really you help a lot.

  • Cette page ne fonctionne pasImpossible de traiter cette demande via à l'heure actuelle. HTTP ERROR 500

  • Error Call to undefined function symlink()