php artisan storage link не работает
Ссылка на хранилище Laravel не будет работать на производстве
я использую storage_path чтобы сохранить мои изображения, и я символизирую свою папку хранения в public_html
На локальном все работает нормально, когда я загружаю изображение, оно загружается в папку хранения и ссылка на него появляется в public папку, но с тех пор как я перешел на рабочий хост и в производственный режим, мои изображения будут загружаться в папку хранения, но ничего в моем public_html/storage и я не могу получить их в моем интерфейсе.
Решение
Спасибо за вашу помощь, Я пытался бежать php artisan storage:link на моем сервере, и я узнал, что мой сервер отключен symlink по соображениям безопасности.
Поэтому я изменил все свои функции загрузки изображений, чтобы загружать изображения в моем public папка вместо storage папка и теперь все работает просто отлично.
Другие решения
изменить настройки storage_path с помощью public_path
если это не работает, вы можете попробовать:
удалить хранилище папок из общедоступного и запустить эту команду в Cron Job [один раз]
Решение:
После того, как ваше приложение загружено на действующий сервер.
Просто проверьте, если у вас есть какая-либо папка для хранения в публичном каталоге.
Проверьте структуру папок
Просто удалите папку хранилища из публичного каталога.
После этого из программного обеспечения замазки получите доступ к вашей основной папке проекта Laravel и выполните эту команду вживую.
Не забудьте настроить свой .окр файл APP_URL = <ваш действующий ip сервера>и затем приведенная ниже команда.
php artisan storage:link not working #623
Comments
kakariko-village commented Aug 24, 2019
ISSUE TYPE
Hi i have a Laravel project that need to run php artisan storage:link for creating storage link for image. The problem is even the command output is «The [public/storage] directory has been linked.», there is no storage folder inside public and of course no images were loaded.
SUMMARY
php artisan storage:link not working
I can load image with storage link
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
vikas5914 commented Aug 24, 2019
I just tried and its working for me. You need to upload your files to storage/app/public folder.
One file at storage/app/public
its output
kakariko-village commented Aug 24, 2019
vikas5914 commented Aug 24, 2019
@kakariko-village try to create a demo txt file like i did and check if you can open it.
kakariko-village commented Aug 26, 2019
I solved it by delete htdocs folder inside my project folder then create it again then run the symlink command to link htdocs with public folder
Tuurlijk commented Sep 1, 2019
@cytopia This issue can be closed
vikas5914 commented Sep 3, 2019
@kakariko-village can you please close this ticket?
stale bot commented Nov 2, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
I’m trying to run the following artisan command:
php artisan storage:link
[ErrorException] symlink(): Protocol error
Can you help me to solve this.
8 Answers 8
Your problem probably is that you have to start your vagrant box as a system administrator.
So hit start type «cmd», right click it choose «Run as administrator». Navigate to your project, type «vagrant up». Retry the command.
/storage or a storage folder in
Run cmd as Super Admin.
php artisan storage:link is OK.
Try to run php artisan storage:link from host machine. This will wok
You must login as cmd administrator, to do this click on the windows key and X. Then select the administrator system symbol. Do not forget to give her vagrant halt at the other terminal.
In my case I run vagrant as Administrator and is working.
Do not forget to vagrant halt on other machine and start new as administrator.
Output:
The [/home/vagrant/code/public/storage] link has been connected to [/home/vagrant/code/storage/app/public].
The links have been created.
I had to migrate my proyect to the storage with NTFS format.
Laravel storage link won’t work on production
I’m using storage_path to save my images and I symbolic my storage folder to public_html
On the local everything works fine, when I upload an image it will upload in storage folder and link of it will appear in public folder but since I moved to live host and production mode my images will upload in storage folder but nothing in my public_html/storage and I’m not able to get them in my front-end.
Codes
13 Answers 13
I see that the question has been answered but I want to suggest another solution which i found to be easy. Go to the route folder your-app-folder/routes/web.php and register a new route as follows
then go to your website www.example.com/linkstorage and it will take you to a blank page. that’s it. The storage folder will be create. I hope it helps someone.
I just encountered this problem, and this is how I fixed it, without the need of SSH’ing into the server or running a CronJob:
For Laravel 5+ (Haven’t tested with lower version)
You may use Artisan::call() method inside your route/controller to execute artisan commands without using the terminal.
delete folder storage From public and run this Command in Cron Job [ one time ]
change storage_path settings by public_path
if that does not work, you can try:
I know it is an old thread but we can change it by a little change in Config/filesystem.php
SOLVED
Thanks for all your helps, I tried to run php artisan storage:link on my server and I found out that my server has disabled symlink for security reason.
So I have changed all my image uploading functions to upload images in my public folder instead of storage folder and now everything is working just fine.
A solution is to upload files and images directly to public_html folder. change config/filesystems.php like this:
What I did to solve this problem:
remove storage folder from the public directory then use this route
I had the same problem, to solve it, I had to delete the storage of the folder which was already created then I relaunched command. PHP artisan storage:link
I had the same issue. The command php artisan storage:link has to be initialized/run again when you start with production on your server. Make sure your webhost provides a SSH access or use a script file with the
command otherwise. I’m using Laravel v8+ and Livewire.
Solution: Once your application is uploaded to the live server. Just check that if you are having any storage folder in public directory. Check the folder stucture
Just delete the storage folder from the public directory.
After that from putty software access your main Laravel project folder, and run this command on live.
Remember to configure your .env file APP_URL=