9

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?

Community
  • 1
  • 1
w3spi
  • 4,380
  • 9
  • 47
  • 80
  • are you using composer to install it? – Jeemusu Sep 16 '15 at 07:35
  • How about this: `dirname(__DIR__).'/vendor/autoload.php'`? Make sure you have ran: `composer update -vvv` successfully. – krisanalfa Sep 17 '15 at 08:01
  • I think that the "trick" in the post you linked to may have messed up the routing for your application. Did you make any modifications to the directory structure because of this? Can you confirm that the file does actually exist? After this, can you confirm that the file is readable by the user that the server runs as? – jeteon Sep 17 '15 at 16:23
  • @KrisanAlfaTimur Many thanks ! You solved my problem – w3spi Sep 17 '15 at 17:10
  • @Zl3n you're welcome :D – krisanalfa Sep 23 '15 at 11:38
  • I tried installing Lumen yesterday and have the same problem. The directory project-name/vendor has been created but it is empty. Is it supposed to contain a file autoload.php? – Andy C Nov 07 '19 at 14:12
  • @AndyC composer update – w3spi Nov 07 '19 at 15:54

2 Answers2

12

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.

krisanalfa
  • 6,268
  • 2
  • 29
  • 38
12

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

composer update -vvv
Lara
  • 2,594
  • 4
  • 24
  • 36
Vinoth
  • 181
  • 4