Home > Back-end >  How to link public storage without ssh access or cron jobs?
How to link public storage without ssh access or cron jobs?

Time:12-14

I need to deploy a laravel app, which uses the storage folder as public storage but I don't have ssh access. I'm trying to find a substitute for:

php artisan storage:link

I've found this thread: Generating a link by putting this route into web.php:

Route::get('generate', function (){ \Illuminate\Support\Facades\Artisan::call('storage:link'); echo 'ok'; });

But it didn't solve the problem. Am I doing it wrong? How do I link public storage?

Edit: The shitty server I'm trying to deploy to doesn't offer cron jobs.

CodePudding user response:

create a corn job if available and after the job run the first time. delete this

ln -s /home/user/laravel/storage/app/public /home/user/public_html/storage

CodePudding user response:

The problem was that I didn't understand how to use the storage link route correctly. I had to add:

Route::get('/linkstorage', function (){
    \Illuminate\Support\Facades\Artisan::call('storage:link');
    echo 'storage linked!';
});

to web.php and actually navigate to domain-name/linkstorage to trigger the artisan call. After that the storage was linked and everything worked.

  • Related