Storage in laravel says symlink - no such file

后端 未结 12 1944
离开以前
离开以前 2020-12-07 22:39

I deployed laravel app on shared hosting in public_html/app folder. Here is everything from public folder. In /../../files I have rest of files. When I do php artisan storag

相关标签:
12条回答
  • 2020-12-07 23:35

    create new php file and put this code on the file:

    <?php
    symlink('/home/CpanelUser/storage/app/public', '/home/CpanelUserpublic_html/storage');
    ?>
    

    "CpanelUser" change to youre cpanel user name or host name.

    Upload this file to public_html folder (www) of site execute file with write site name+this file in browser done!

    Example: My file name is symlink.php and site name is www.anysite.com upload symlink.php to public_html folder in host and get web address in browser

    http://www.anysite.com/symlink.php

    after execute this file storage folder creite in public folder in laravel and link to storage folder in app.

    0 讨论(0)
  • 2020-12-07 23:36

    Delete the existing storage symbolic link (public/storage) and then run php artisan storage:link command again.

    0 讨论(0)
  • 2020-12-07 23:37

    This usually happens after moving Laravel app to another directory

    The actual storage directory is "/AppName/storage/app/public/"

    Laravel creates a symbolic link pointing to actual storage dir "/AppName/public/storage"

    Other meaning

    "/AppName/public/storage" points to => "/AppName/storage/app/public/"

    On changing root app directory to "/AnotherAppName/" symlink will still point to the old path

    "/AnotherAppName/public/storage" => "/AppName/storage/app/public/"

    my solution is to manually update the symlink using

    ln -sfn /AnotherAppName/storage/app/public/ /AnotherAppName/public/storage
    
    0 讨论(0)
  • 2020-12-07 23:37

    I was using Vagrant and had the same problem. I removed to storage directory in public/storage but couldn't resolve the problem when using the command php artisan storage:link.

    Therefore I connected with ssh to my vagrant box and ran the command there. It worked, so if you are running Vagrant and have the same problem this might help.

    0 讨论(0)
  • 2020-12-07 23:41

    To fix this error on your server, change directory to the public and remove the symbolic link for the storage folder.

    The following commands will help you remove the symbolic link from the public folder:

    cd public
    rm storage
    

    After removing the symbolic link change directory to the main folder using:

    cd ..
    

    Now create the symbolic link with the following command:

    php artisan storage:link
    

    After running the command successfully, you should get the following message

    The [public/storage] directory has been linked.
    

    I hope this post helps you.

    SYMLINK(): No Such File or Directory Laravel

    0 讨论(0)
  • 2020-12-07 23:44

    Follow these three steps:

    1. Remove storage file from public folder.

      rm public/storage

    2. If storage folder is there in your root directory, remove public file inside app folder.

      rm storage/app/public

    3. Run link command

      php artisan storage:link

    0 讨论(0)
提交回复
热议问题