failed opening required 'vendor/autoload php laravel

failed opening required 'vendor/autoload php laravel

PHP Warning: require(/vendor/autoloadphp): failed to open stream: No such file or directory in /laravel/artisan on line. What you're missing is running composer install, which will import your packages and create the vendor folder, along with the autoload script. Make sure your relative path is correct.

composer install


composer update
What you’re missing is running composer install, which will import your packages and create the vendor folder, along with the autoload script.
Make sure your relative path is correct. For example, the example scripts in PHPMailer are in examples/, below the project root, so the correct relative path to load the composer autoloader from there would be ../vendor/autoload.php.
The autoload.php you found in
../vendor/autoload.php is probably a global composer installation — where you’ll usually put things like phpcs, phpunit, phpmd etc.

  • Laravel Version: 5.4.33
  • PHP Version: 7.0.22-0ubuntu0.16.04.1
  • Database Driver & Version: MySQL/MariaDB 10.0.31


Running php artisan key:generate in a Laravel project where the .env file does not contain an APP_KEY= line results in the following output:
Application key [base64:KEY_HERE=] set successfully.
However, the key is not written to the .env file, so the status message is incorrect.

Steps To Reproduce:

  1. Create a .env file without an APP_KEY= line.
  2. Run php artisan key:generate
  3. Run grep APP_KEY .env - no output.

Possible fixes

I can think of two ways to improve this for the user:
  1. Have key:generate check whether APP_KEY exists after generating the key, and display an error message if it does not exist or match the key which was generated.
  2. Append the relevant APP_KEY to .env if the line does not already exist, perhaps with a slightly different output message to make it clear that this has happened.
Unfortunately I'm new to Laravel so don't feel confident providing a patch to a piece of core functionality.


Post a Comment