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

webdesign's avatar

hi guys it works for me .... you can use it

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

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

?>

SalemCode8's avatar

for the latest version of laravel the solution is to add this change in bootstrap/app.php.

$app->usePublicPath(base_path('public_html'));

after this line

$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
Previous

Please or to participate in this conversation.