Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bhhussain's avatar

php artisan storage link error in CPANEL

Hi,

When I try to run the php artisan storage link in CPANEL terminal it is generating the below error

 ErrorException  : symlink(): No such file or directory

  at /home/abc/customer/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:252
    248|      */
    249|     public function link($target, $link)
    250|     {
    251|         if (! windows_os()) {
  > 252|             return symlink($target, $link);
    253|         }
    254|
    255|         $mode = $this->isDirectory($target) ? 'J' : 'H';
    256|

  Exception trace:

  1   symlink("/home/abc/customer/storage/app/public", "/home/abc/customer/public/storage")
      /home/abc/customer/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:252

  2   Illuminate\Filesystem\Filesystem::link("/home/abc/customer/storage/app/public", "/home/abc/customer/public/storage")
      /home/abc/customer/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.ph   p:35

 

Can any one please help me.

Thank you

0 likes
5 replies
bhhussain's avatar

@nakov Thank you very much for your reply.

Upto my understanding when we run the php artisan storage:link then the system will create a shortcut folder inside the public folder but when I follow the steps in the above link it is creating the storage folder inside the public folder but not working..

Nakov's avatar

@bhhussain

Upto my understanding when we run the php artisan storage:link then the system will create a shortcut folder

The shortcut folder is the storage folder inside the public folder.

bhhussain's avatar

@nakov Thanks,

Shortcut storage folder created but my actual files saved inside the categories folder inside the storage folder

My actual files stored in

 customer/storage/app/public/categories

but the link given to

public_html/public/

I tried like below but it is not working, it means the below code creating the shortcut folder storage inside the public folder but In my case it should be /public/storage/categories

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

Please or to participate in this conversation.