warning: require(/var/www/html/public/../vendor/autoload.php): failed to open stream: no such file or directory in /var/www/html/public/index.php on line 24

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 C:\Windows\SysWOW64\vendor\autoload.php is probably a global composer installation – where you'll usually put things like phpcs, phpunit, phpmd etc.

composer update is not the same thing, and probably not what you want to use. If your code is tested with your current package versions then running update may cause breakages which may require further work and testing, so don't run update unless you have a specific reason to and understand exactly what it means. To clarify further – you should probably only ever run composer update locally, never on your server as it is reasonably likely to break apps in production.

I often see complaints that people can't use composer because they can't run it on their server (e.g. because it's shared and they have no shell access). In that case, you can still use composer: run it locally (an environment that has no such restrictions), and upload the local vendor folder it generates along with all your other PHP scripts.

Running composer update also performs a composer install, and if you do not currently have a vendor folder (normal if you have a fresh checkout of a project), then it will create one, and also overwrite any composer.lock file you already have, updating package versions tagged in it, and this is what is potentially dangerous.

Similarly, if you do not currently have a composer.lock file (e.g. if it was not committed to the project), then composer install also effectively performs a composer update. It's thus vital to understand the difference between the two as they are definitely not interchangeable.

It is also possible to update a single package by naming it, for example:

composer update ramsey/uuid
This will re-resolve the version specified in your composer.json and install it in your vendor folder, and update your composer.lock file to match. This is far less likely to cause problems than a general composer update if you just need a specific update to one package.

It is normal for libraries to not include a composer.lock file of their own; it's up to apps to fix versions, not the libraries they use. As a result, library developers are expected to maintain compatibility with a wider range of host environments than app developers need to. For example, a library might be compatible with Laravel 5, 6, 7, and 8, but an app using it might require Laravel 8 for other reasons.

Composer 2.0 (out soon) should remove any remaining inconsistencies between install and update results.

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
PHP Warning: require(/home/sohaib/Desktop/LaraShop-master/vendor/autoload.php): Failed to open stream: No such file or dir Warning: require(D:\laragon\www\glitter\public/../vendor/autoload.php): failed to open stream: No such file or directory in \public\index.php on line 34 Warning: require(/var/www/html/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/app/bootstrap.php on line 18 Warning: require(/home/imranfah/public_html/vendor/autoload.php): failed to open stream: No such file or directory in /home/imranfah/public_html/index.php on line 24 PHP Warning: require(/mnt/c/Projects/cdm/vendor/autoload.php): failed to open stream: No such file or directory in PHP Warning: require(/home/developer/Desktop/example-app/vendor/autoload.php): failed to open stream: No such file or directory PHP Warning: require(/var/www/html/mautic/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/mautic/autoload.php on line 13 Warning: require(C:\laragon\www\Hama\public/../vendor/autoload.php): failed to open stream: No such file or directory in C:\laragon\www\Hama\public\index.php on line 24 PHP Warning: require(/var/www/html/MaldororAPI/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/MaldororAPI/artisan on line 18 Warning: require(/var/www/html/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 34 Warning: require(/home/warpandw/public_html/../vendor/autoload.php): failed to open stream: No such file or directory in /home/warpandw/public_html/index.php on line 34 Warning: require(/home2/elitefb0/public_html/../vendor/autoload.php): failed to open stream: No such file or directory in /home2/elitefb0/public_html/index.php on line 24 PHP Warning: require(/var/www/html/laravel/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/laravel/artisan on line 18 Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/config/bootstrap.php on line 5 Warning: require(/var/www/html/admin/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/admin/public/index.php on line 34 laravel Warning: require(/var/www/html/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 24 Warning: require(/var/www/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/index.php on line 8 PHP Warning: require(/var/www/html/afferwatsales/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/afferwatsales/artisan on line 18 laravel Warning: require(/var/www/html/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 24 Warning: require(/var/www/html/public/../vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/public/index.php on line 34 docker Warning: require(/var/www/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/public/index.php on line 24 Warning: require(/var/www/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/public/index.php on line 24 Warning: require(C:\laragon\www\mt\public/../vendor/autoload.php): failed to open stream: No such file or directory in C:\laragon\www\mt\public\index.php on line 34 require(/var/www/html/code/project/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/code/project/artisan on line 18 require(/var/www/vendor/autoload.php): Failed to open stream: No such file or directory in Warning: require(C:\laragon\www\mindzapp/vendor/autoload.php): failed to open stream: No such file or directory in C:\laragon\www\mindzapp\artisan on line 18 PHP Warning: require(/var/www/html/anonyma/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/anonyma/artisan on line 18 Warning: require(/var/www/html/web/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/web/autoload.php on line 17 Warning: require(/var/www/web/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/web/autoload.php on line 17 Warning: require(/var/www/public/../vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/public/index.php on line 34 warning: require(/var/www/html/public/../vendor/autoload.php): failed to open stream: no such file or directory in /var/www/html/public/index.php on line 24
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source