Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: require(...): failed to open stream: No such file or directory in

just moved over my laravel site to my live server and straight away faced with this error.

The complete error is:

Warning: require(/var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/autoload.php on line 17

Fatal error: require(): Failed opening required '/var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/sites/b/beta.buildsanctuary.com/public_html/local/bootstrap/autoload.php on line 17

The line 17 is:

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

Folder structure is:

beta.buildsanctuary.com
  -- public_html
  -- subdomains
    -- beta
      -- local
        -- bootstrap
        -- vendor

Any help where this is going wrong? And how to fix? Pulling my hair out trying all sorts of paths.

Thanks, Craig.

like image 907
Lovelock Avatar asked Nov 07 '14 22:11

Lovelock


2 Answers

As you can see from the error, PHP is looking for

public_html/local/bootstrap/../vendor/autoload.php`

which is

public_html/local/vendor/autoload.php

That folder does not exist. I think the folder structure you posted is wrong.

Anyway, try this:

require('../vendor/autoload.php');
like image 65
Chris54721 Avatar answered Nov 14 '22 22:11

Chris54721


I strongly believe that a corrupted cache was the cause, I cannot be 100% sure but it seem that it is likely the culprit.

So, if anyone comes across a similar problem, I would suggest the following steps:

  1. Delete the vendor folder
  2. Delete composer.lock
  3. Run the command composer clearcache (or clear-cache)
  4. Run composer install

I hope this can help somebody.

like image 20
dmSherazi Avatar answered Nov 14 '22 21:11

dmSherazi