Search code examples
phplaraveldirectorypublicvendor

Moving laravel vendor to server


I'm transferring laravel to the server for the first time. I have folder public_html, which the server points.

Folder vendor etc. should I move to public_html or parent folder and folder (which was created by laravel) 'public' rename to 'public_html'?


Solution

  • Follow the steps carefully

    1. Create a folder inside /public_html i.e- /public_html/myproject
    2. upload your project and extract, then move the whole project inside public_html/myproject/
    3. Now go to the public folder and which is inside public_html/myproject/public
    4. Get all files from public_html/myproject/public/ and move to /public_html/
    5. Now open index.php file which is inside /public_html/index.php and edit this file
    6. Find out:

      require __DIR__.'/../vendor/autoload.php';

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

    Replace with

    require __DIR__.'/myproject/vendor/autoload.php';
    
    $app = require_once __DIR__.'/myproject/bootstrap/app.php';
    
    1. Now you're ready to go. Just setup your database carefully!!