in the most shared servers the default public folder is named public_html or www, whats may present a problem since the server document root and Laravel public folder are not the same.
Let's fix it following this 3 steps:
That´s it, just do it.
In app/Providers/AppServiceProvider.php
add to the function register()
:
$this->app->bind('path.public', function() {
return base_path('public_html');
});
In bootstrap/app.php
add at the end of the file but before return $app;
:
$app->bind('path.public', function() { return base_path().'/public_html'; });
this will bind Laravel document root with the correct one, in this case we are linking it to public_html folder, you can also put the full path to your document root instead of the dynamic approach.
Hey, Does this work for the latest version of Laravel or does it need any changes?