0
votes

Laravel Version: 5.5 Voyager Version: 1.0 PHP Version: 7

I have uploaded my laravel project in cPanel. Previous images are shown successfully but the newly added images are not showing.

enter image description here

Here last 2 images are already in the project before uploading in cPanel. After uploading the project successfully in cPanel I have try to upload an image but it is not shown which is first one.

Anybody help ?

i tryed with change in config/filesystem.php

Change the path from storage_path() to public_path().

'public' => [ 'driver' => 'local', 'root' => public_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ],

but it not worked. please help me!

broken image url- http://example.com/storage/products/December2018/QIDyzoFg1aAf6NUGMJtZ.jpg

2

2 Answers

0
votes

i found the solution ! the promblem was in the symlink(storage symbolic link). in the localhost we can easily create the symlink from voyager adminpannel or in terminal php artisan storage:link in that case in shared hosting we cannot do that .see below what i do.

1.log in to the cpannel

2.go the project folder then go public->storage folder then rename it to storage old or somthing.

3.come back to the cpannel main menu and select the cron job

4.in common settings --> select *once per 5 minutes

5.in the command field add this ln -s /home/cpanel_username/project_name/storage/app/public /home/cpanel_sername/project_name/public/storage

(my site was in subdomain) example-ln -s /home/your_cpannel_user name/public_html/subdomain_foldername/storage/app/public /home/cpanel_username/public_html/subdomain_foldername/public/storage

syntax-->ln -s target_path link_path

6.type your email in the cron email and update email(when the job was done email notification wiil come to your inbox check the spam folder)

6.create new cronjob

7.wait few minutes you almost done.! after the execution delete the cronjob

8.log and check upload path working correctly!

0
votes

Assuming that your Laravel project "public" directory and "public_html" directory are different, please run the following command:

php artisan storage:link 

This command will create symlink to "public" directory to your Laravel project, not inside the "public_html". Next we'll need to move the "storage" link to "public_html" directory, for this you can move directly. If it doesn't work then go inside the "public" directory and run the below command according to your public_html directory location:

mv storage /home/*yourHostinInfo*/domains/*domainName*/public_html

The path might be different based on your hosting information.