laravel5: chdir(): No such file or directory (errno 2)

后端 未结 9 1141
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 18:37

I have a problem when deploy website build on laravel 5 into VPS server, but on local machine it work fine.

My page is http://easyway.vn/ current page display blank

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 19:22

    I know you asked this question a long time ago but for those who seek the easiest and efficient way to solve this problem:

    This error means laravel can't find the public folder.You must add this piece of code in the register method of Providers/AppServiceProvider.php:

    public function register()
    {
        $this->app->bind('path.public', function() {
           return base_path('PATH TO PUBLIC FOLDER');
        });
    }
    

    Example with public_html

    In your case,, the path for public HTML will be:

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

    This way Laravel knows where to look to find the public folder path.

提交回复
热议问题