upload my project laravel to a shared host

微笑、不失礼 提交于 2019-12-07 23:23:12

问题


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.


回答1:


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.




回答2:


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.)



来源:https://stackoverflow.com/questions/36475891/upload-my-project-laravel-to-a-shared-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!