Forum

Please or Register to create posts and topics.

How To Create Symlink For Laravel Website In cPanel

How to create symbolic link for laravel website in cpanel, that is Laravel Storage Symlink.

There is an simple way to do so, by creating a file and running it. Just follow these steps.

Storage symlink

  1. Make sure you do not have a storage folder create in the public folder. (public_html/public/storage). If so then remove it.
  2. Create a PHP file name symlink.php in the root folder, which is in the public_html folder.
  3. And now paste this code.

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

Now open the file you have just created. The URL would be something like this website.com/symlink.php and this is done. Now you can see the public folder has a storage folder created.