2

I have a shared hosting service hostinger. as I can upload my laravel 5.2 and configure project?

and I tried using:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider {
/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot() {
    //
}

/**
 * Register any application services.
 *
 * @return void
 */
public function register() {

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

but still nothing.

Reco Jhonatan
  • 1,503
  • 4
  • 23
  • 35

2 Answers2

3

I guess easiest and better approach in this situation will be creating of a symlink between public_html and public folders. Example for Ubuntu/Debian:

ln -s /path-to-pub/public_html /path-to-pub/public

This solution is better because when you'll decide to move your project to VPN, dedicated server etc., you will not need to remember about any modifications you made and rewrite any code.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • thank you for the advice. as I do the distribution of the laravel project folders? – Reco Jhonatan Apr 07 '16 at 13:26
  • 1
    If you have `/home/user543/public_html` directory structure, for example, upload your Laravel files into `user543` directory. So `public_html` and `public` directories will be in the same directory (on the same level). – Alexey Mezenin Apr 07 '16 at 13:32
1

Put this code:

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

to bootstrap/app.php and You are good to go. (I assuming that You renamed public directory already.)

Giedrius Kiršys
  • 5,154
  • 2
  • 20
  • 28