Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

YuMp's avatar
Level 2

Storage:link on shared hosting problem

Hello, I made the modification in my AppServiceProvider for public_html folder but I can't create the symbolic link storage using Web Routes thanks in advance. Any help is welcome my AppServiceProvider -->

public function register()
{
      $this->app->bind('path.public', function() {
        
        return base_path('public_html');
    });
    Paginator::useBootstrap();
}

Route

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

FileSytem -->

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'throw' => false,
    ],

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

'links' => [
    public_path('storage') => storage_path('app/public'),
],
0 likes
1 reply
tisuchi's avatar
tisuchi
Best Answer
Level 70

@yump There could be a few different things causing the issue with creating the symbolic link using storage:link on your shared hosting. Here are a few things to check:

  • Make sure that your shared hosting provider allows you to create symbolic links. Some providers do not allow this for security reasons.
  • Make sure that the php user has the necessary permissions to create symbolic links. You can check with your hosting provider to see if this is the case and if they can grant the necessary permissions.
  • Check the value of storage_path('app/public') and public_path('storage') are correct, it should be the path of your public_html folder.
  • In your filesystems.php config file, check that the 'root' values for both the 'local' and 'public' disks match the path to your storage folder.
  • Make sure that there is no other route that is conflicting with your storage route and causing the problem.
  • You can also check the error logs of your server for more details about the error.

It's possible that due to shared hosting configurations, you might not be able to use storage:link command to create the symlink, in this case you will have to manually create the symlink using the ln -s command via ssh or using the file manager provided by your hosting provider.

1 like

Please or to participate in this conversation.