PHP Warning: require(/vendor/autoload. php): 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
//ORcomposer 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.
../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
Description:
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:
- Create a
.env
file without anAPP_KEY=
line. - Run
php artisan key:generate
- Run
grep APP_KEY .env
- no output.
Possible fixes
I can think of two ways to improve this for the user:
- Have
key:generate
check whetherAPP_KEY
exists after generating the key, and display an error message if it does not exist or match the key which was generated. - 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.
1 Comments
good
ReplyDeleteCAN FEEDBACK
Emoji