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

后端 未结 9 1124
佛祖请我去吃肉
佛祖请我去吃肉 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:36

    it means that your Laravel Application Can't Find the public folder.

    I got it to work by

    changing :

    chdir($this->laravel->publicPath());
    

    in :

    vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php

    To :

    chdir('/');
    
    0 讨论(0)
  • 2020-12-01 19:38

    this error appears when you rename the public folder.

    Never edit files in vendor folder. After composer update or fresh install you will lose your changes.

    A better solution is to edit bootstrap/app.php and place this snippet before the return statement.

    $app->bind('path.public', function() {
        return base_path() . '/web';
    });
    
    0 讨论(0)
  • 2020-12-01 19:40
    1. Step one In vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php
    `chdir($this->laravel->publicPath());`
    
    change to 
    

    chdir('/');

    2.Step two Change these two paths in your_public_folder/index.php

    require __DIR__.'/../your_app/bootstrap/autoload.php';

    $app = require_once __DIR__.'/../your_app/bootstrap/app.php';

    3.Step three Change public path in your_app/server.php

        if ($uri !== '/' && file_exists(__DIR__.'/../public_html/'.$uri)) {
        return false;
    }
    
    require_once __DIR__.'/../public_html/index.php';
    

    Note: Change these path according to your App's new folder structure.

    0 讨论(0)
提交回复
热议问题