@johndoe220 I think you have to rerun the php artisan storage:link in your host
storage:link not working in host
Hi, on localhost by running the command php artisan storage: link the files I upload are transferred to the public folder, and everything works fine, but on the host I have a problem when uploading the file that instead of the file in The public folder is saved in Storage-> app-> public-> uploads, what can I do to fix this problem? Thank you.
because use vps server , so I do not have access to ssh for run this command
@johndoe220 well that's unfortunate because you need to re-run that command for it to be able to symlink again.
thank's, so you say delete old zip file on host and again run command "php artisan storage:link" and upload again?
@johndoe220 no, you don't need to re-upload anything. You need to run php artisan storage:link on the server itself not on your local.
Unfortunately, no way running this command in vps server, anyway thank you
1.Delete storage folder symbolic link in root_of_project/public/. If exists.
2.Run php artisan storage:link command.
3.Upload your files to root_of_project/storage/app/public/
also told my dear neilstee, because use vps server , so I do not have access to ssh for run this command on host
If you don't have ssh access then its not following the common definition of a VPS - its just shared web hosting
If you cannot run any artisan commands then you need to change where you store the uploads and write them directly to the public folder.
You can edit the config/filesystems.php file to redefine the default storage folder.
it's true, but this is not standard method! i will used this method because i think beautiful method
Then seek better hosting. You will run into lots of issues without ssh access
In Laravel documentation, a symbolic link (symlink or soft link) from public_html/storage to storage/app/public should be created to make files accessible from the web.
(THIS PROCEDURE WILL CREATE SYMBOLIC LINK WITHIN THE LARAVEL PROJECT DIRECTORY)
Here are the steps on how you can create symbolic link in your Linux web server using SSH client:
-
Connect and login to your web server using SSH client (e.g. PUTTY).
-
Link storage/app/public_html to public/storage using the syntax.
ln -s target_path link_path Example (in CPanel File Directory)
ln -s /home/cpanel_username/project_name/storage/app/public /home/cpanel_sername/project_name/public_html/storage
@adamboniecki@gmail.com Did you READ this 9 month old thread?
I have created an answer for this problem and I hope it works for you guys. I am using hostinger and purchased the premium one with the ssh access. I accessed my ssh to the main folder public html and run a similar code to this:
ln -s /home/u789790412/domains/tomvpn.appapistec.xyz/storage/app/public /home/u789790412/domains/tomvpn.appapistec.xyz/public_html/public
Now, do exactly as I do. Go to public_html/public folder and there you will see a public-> link folder like that. Rename that into storage.
Then the links will now work. The renaming is the trick i used because when i am developing it on my local device, i am using asset('storage/...'), that why i have adjust it and renamed the folder to storage.
I am uploading files and the link works fine because I think, the link also adjust when I had run the location link.
I hope this will help you.
@arthurcervania Better to not put your entire codebase in the public domain.
Better than better is to not encourage others to do the same as you.
ln -s $(pwd)/storage/app/public $(pwd)/public/storage
try above command in command is not working
Please or to participate in this conversation.