Laravel中的存储说符号链接-没有这样的文件 [英] Storage in laravel says symlink - no such file
问题描述
我在public_html/app文件夹中的共享主机上部署了laravel应用.这是公用文件夹中的所有内容.在/../../files中,我有其余文件.当我执行php artisan storage:文件文件夹中的链接时,我的控制台显示
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 storage:link in files folder my console says
[ErrorException]
symlink(): No such file or directory
在localhost上,我将文件上传到storage/uploads文件夹.现在要做什么?我试图更改链接,但对我没有任何帮助...
On localhost I upload files to storage/uploads folder. What to do now? I tried to change links but nothing works for me...
推荐答案
-
转到
/public
目录并运行:
rm storage
转到Laravel根目录并运行:
Go to Laravel root directory and run:
php artisan storage:link
于2018年5月1日编辑
Edited on May 1st 2018
当laravel项目移动/复制到其他文件夹时,会出现此问题.
This problem comes when laravel project is moved/copied to some other folder.
存储链接仍然存在,从而导致异常错误.公共/存储文件夹存在,并且指向错误的位置,需要使用rm storage
命令将其删除.
The storage link is still there thus causing the exception error. public/storage folder exists and points to wrong location and it needs to be deleted with rm storage
command.
之后,在终端中运行php artisan storage:link
,它将创建存储链接.
After that run php artisan storage:link
in terminal and it will create the storage link.
每次移动/复制/部署laravel时,都需要执行此操作!
This needs to be done EVERY time when laravel is moved/copied/deployed!
这篇关于Laravel中的存储说符号链接-没有这样的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!