I had the same problem. Using this in bootstrap/app.php worked for me:
$app->usePublicPath(base_path('public_html'));
Hi guyz, in early versions of laravel, it was easy to change default public path. I was editing the line in server.php file:
require_once __DIR__.'/public_html/index.php';
But in laravel 10, there is no server.php file and even though I bind the 'path.public' to container, laravel throws error and server is never being initialized. What I tried is:
$this->app->bind('path.public', function () {
return base_path('public_html');
});
What error I got when I try to initialize artisan server is:
The provided cwd "C:\Users\evren\Desktop\hello-world\public" does not exist.
For conclusion, my app was able to use public_html as public path in laravel 9 but when I upgraded base code to laravel 10, my app could not use public_html longer.
Some usefull dd's:
> public_path()
= "C:\Users\evren\Desktop\hello-world\public"
> app('path.public')
= "C:\Users\evren\Desktop\hello-world\public_html"
Please or to participate in this conversation.