Debug School

rakesh kumar
rakesh kumar

Posted on

Laravel:require(vendor/autoload.php): failed to open stream

ERROR
requirevendor-autoload-php-failed-to-open-stream

I know that this issue has been posted many times, but for me it seems to be a different problem.

Indeed, this error

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\site_web\send_mail.php on line 3

Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\site_web\send_mail.php on line 3

appears at the begining of my code from this line:

require 'vendor/autoload.php';
So, I guess there must be a /vendor/autoload.php file somewhere in my computer (I have installed composer and ran composer require phpmailer/phpmailer).

So, I looked for this file using: dir /s autoload.php in the Windows command line, and found one here: C:\Windows\SysWOW64\vendor\autoload.php,

but for me, syswow64 folder has nothing to see with autoload.php, I don't see what I am missing here.

Solution

composer update
Enter fullscreen mode Exit fullscreen mode

Another Solution

If you get the error also when you run

composer install
Enter fullscreen mode Exit fullscreen mode

Just run this command first

composer dump-autoload
Enter fullscreen mode Exit fullscreen mode

This command will clean up all compiled files and their paths.

Top comments (0)