Home » Php » Lumen failed to open /../vendor/autoload.php

Lumen failed to open /../vendor/autoload.php

Posted by: admin July 12, 2020 Leave a comment

Questions:

I started using Lumen upon its release in April.

From version 5.0, I already faced this same problem and found a solution (see here).

There are some days I proceeded to create a new project in Lumen (5.1). However, by applying the method with the .htaccess above, the problem doesn’t solve it this time.

Here is the full error :

Warning: require_once(path_of_the_project/../vendor/autoload.php): failed to open stream: No such file or directory in path_of_the_project\bootstrap\app.php on line 3

Fatal error: require_once(): Failed opening required ‘path_of_the_project\bootstrap/../vendor/autoload.php‘ (include_path=’.;C:\php\pear’) in path_of_the_project\bootstrap\app.php on line 3

How to fix it?

How to&Answers:

In your bootstrap/app.php file, change:

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

Into:

require_once dirname(__DIR__).'/vendor/autoload.php'; 

And make sure you have ran composer update -vvv SUCCESSFULLY.

Answer:

I got the same error and resolved it by running the below command from project root folder.

composer update -vvv