I am having trouble linking my storage folder correctly using “php artisan storage:link”
On prod server I have “public_html” instead of “public”. Thus, I have:
in AppServiceProvider.php
public function register(): void
{
//Public folder name changed with public_html
$this->app->bind('path.public', function () {
return base_path() . '/public_html';
});
}
app.php
->registered(function ($app) {
$app->usePublicPath(path: realpath(base_path('public_html')));
})
and filesystems.php
'public' => [
'driver' => 'local',
'root' => storage_path('app/public_html'),
'url' => env('APP_URL') . '/storage', //'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
'throw' => false,
],
...
'links' => [
public_path('storage') => storage_path('app/public_html'), // org: app/public
],
But still, when I runphp artisan storage:link
, it tries to link “publicstorage” to “storageapp/public_html”.
I expect it to link “public_htmlstorage” to “storageapp/public_html”
I don’t know if there are any other config files where I have to tell Laravel it’s “public_html” and not “public”