I have shared my Laravel project, but the images don’t show on the production. On the other hand, the project is working perfectly locally, but I faced a problem when I want to run php artisan storage:link
on the server in order to show images.
Server OS:Linux GNU/Linux
PHP version : 7.4
Laravel version: 8
yf*******@sg3pl***** [~/a***]$ php artisan storage:link
ErrorException
symlink(): No such file or directory
at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:315
311▕ */
312▕ public function link($target, $link)
313▕ {
314▕ if (! windows_os()) {
➜ 315▕ return symlink($target, $link);
316▕ }
317▕
318▕ $mode = $this->isDirectory($target) ? 'J' : 'H';
319▕
+15 vendor frames
16 artisan:37
IlluminateFoundationConsoleKernel::handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
Thanks in advance.
2
Answers
I have been solving this issue.
I was wrong, for I deleted the public folder from my project. Moreover, when I deleted the public folder from my project folder, I couldn’t link a storage folder, so I should keep the public file in the main folder project.
=>
cd FILE_PROJECT
in the root.=>
mkdir public
.=>
php artisan storage:link
This way works for me.
My similar problem was solved by adding FILESYSTEM_DRIVER = public in .env, you can try this.