php fatal error require failed opening required vendor autoload php

require(vendor/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.

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:

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 ).

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

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

17 Answers 17

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.

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

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 removed any remaining inconsistencies between install and update results; if you’re running composer 1.x you should definitely upgrade.

Источник

Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

I have recently installed Laravel 5 via composer. I tried creating a new controller using artisan and I get the following error:

bootstrap/../vendor/autoload.php. Failed to open stream: No such file or directory. The «vendor» folder does not exist.

Am I missing something?

28 Answers 28

This shall fix the issue. I tried this on Mac and Linux.

set path to www/

For me : www/laravel5

Then type this command : composer install

It will automatically install all dependency in vendor/

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

Run composer install in your root project folder (or php composer.phar install ).

Turns out I didn’t enable openssl in my php.ini so when I created my new project with composer it was installed from source. I changed that and ran

now the vendor folder was created.

Did you create a new project or did you clone an existing project?

If you cloned an existing project it’s very important to run

That way all the dependencies that are missing will be installed.

But if you create a new project you should run this command to make a new project using composer

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

I encountered the same problem. It occurred because composer was not able to install the dependencies specified in composer.json file. try running

If this does not solve the problem, make sure the following php modules are installed php-mbstring php-dom

To install this extensions run the following in terminal

once the installation is complete

try running the command in your project root folder

Following this below step solved my problem. You may try

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

You need to regenerate autoload.php file. you can use dump-autoload to do that without having to go through an install or update.

to generate autoload.php file again in /vendor directory.

Just run this inside the directory where you installed your project

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

go to your project folder via cmd. run the following command

it will install the missing vendor folder and files in your project.

for that go to your composer.json file,

change «secure-http»: true to «secure-http»: false

but in some cases (as was in my case) you may not find such line in your file. for that do the following action:

and run again composer update command.

hope this will solve problem.

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

This solution worked for me. The reason is not to have a vendor folder in your application.

Follow these steps:

if your project has composer.json file, delete it

That command add vendor folder to your project

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

Just run the following commands,

Composer is a dependency manager allows you to delegate responsibility for managing your dependencies to a third party.

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

Just setup a new project using composer instead of laravel like this:

Delete Vendor then composer install

php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

Before you carry out the following instructions you need to make sure you have composer installed globally on your machine; Open you Mac terminal and run the following command:

once composer is installed globally run the following command after you are in the directory of the project:

once completed in it update and install all the required packages.

I had same problem with laravel and artisan, the solution:

We got an error because we have missing vendor folder in our project, The vendor directory contains our Composer dependencies.

Need /vendor folder because all packages are there and including all the classes Laravel uses, A problem can be solved after following just two steps:

These two commands, we will Recreate the vendor folder in our project and after that our project will be working smoothly.

Источник

Fatal error: require(): Failed opening required ‘vendor/autoload.php’ in Laravel project/Serpwow API

I know there are already a lot of topics and solutions about this error, but nothing seems to work for me.

So, I’m having a Laravel project created with composer. To run the project I use the «php artisan serve» command. In my project, I’m using the SerpWoW API, an easy to use API for Google images etc. since yesterday, installed with composter (composer require serpwow/google-search-results). But since then I’m having trouble with vendor/autoload.php.

In one of SerpWoW’s config files, there’s a line:

Like this, I’m able to run the serve command and to start the project. Unfortunately, my views (.blade.php files) are giving the error: Fatal error: require(): Failed opening required ‘vendor/autoload.php’ (include_path=’C:\xampp\php\PEAR’) in (path to that config file)

and my views came back. Problem solved I thought. But now I’m getting the error when I try to run the serve command to run my project. Same error pointing to same file and so unable to start my project. When I reverse my solution I’m able again to start my project but my views are giving the error again (I know, it’s complicated). What I’m doing now is starting my project with original path, then change the path in the file, save it and so I’m able to see my views.

I’ve already run composer install and composer update for a few times in my project directory but that didn’t help. Hope someone knows a solution for this.

Источник

Fatal error: require(): Failed opening required ‘/var/www/html/vendor/autoload.php’ #3

Comments

selvakumarEsra commented May 2, 2016

Warning: require(/var/www/html/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/dynamodb/createtables.php on line 12

Fatal error: require(): Failed opening required ‘/var/www/html/vendor/autoload.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /var/www/html/dynamodb/createtables.php on line 12

The text was updated successfully, but these errors were encountered:

We are unable to convert the task to an issue at this time. Please try again.

The issue was successfully created but we are unable to update the comment at this time.

furkankadioglu commented Jun 4, 2016

Needs to composer & require aws-sdk-php.

nandakishore8031 commented Sep 30, 2016

I got the same error too. Please let me know what to be done.

unacceptable commented Mar 14, 2017 •

I have just run into this issue as well. I was able to resolve this by finding where the file was located and modifying the php script to match. (I literally only added ‘dynamodb/’ to the file path as specified in the script):

Line numbers for the lines in these files are as follows (note that the period is a hard link to the current working directory). There will also be an error for describing the line number of the failure in the web browser.

Hopefully this will clear up this for some people. ACloudGuru please update this at your earliest convenience.

Respectfully,
Robert J.

GodStorm91 commented Jul 5, 2017

As in my casse I do the following
[ec2-user@ip-172-31-26-96 www]$ sudo su
[root@ip-172-31-26-96 www]$ cd /var/www/html
[root@ip-172-31-26-96 www]$ cd /var/www/html
Install the required sdk
[root@ip-172-31-26-96 html]# php composer.phar require aws/aws-sdk-php

And the result when I rerun
php fatal error require failed opening required vendor autoload php. Смотреть фото php fatal error require failed opening required vendor autoload php. Смотреть картинку php fatal error require failed opening required vendor autoload php. Картинка про php fatal error require failed opening required vendor autoload php. Фото php fatal error require failed opening required vendor autoload php

aniket91 commented Apr 15, 2018 •

temmyakins commented Sep 9, 2018

This error could even actually be that your composer.phar needs to be updated.

If you observe carefully you will notice that when you run ls on your html you might not find composer.lock
Also regarding this issue, if you navigate to your vendor folder i.e. cd Vendor, you will notice it doesn’t have the «autoload.php» which is the main cause of the issue.

[root@ip-172-31-18-42 html]# php composer.phar require aws/aws-sdk-php Using version ^2.8 for aws/aws-sdk-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals

In a nut shell, Just simple run the command below in the hmtl directory

php composer.phar update

Then you are good to go, Your files will update in the dynamodb sucessfully after wards.

Источник

Php fatal error require failed opening required vendor autoload php

I achieved a Laravel5 website running OK on my local server and uploaded on bitbucket.\nI decided to use Forge+Digital Ocean for the deployment on remote server. \n

I encounter a first deployment failure with\n’ \/home\/forge\/default\/bootstrap\/cache directory must be present and writable’\non Forge that i solved by installing the project without installing the composer dependencies. \n

Warning: require(\/home\/forge\/default\/public\/..\/vendor\/autoload.php): failed to open stream: No such file or directory in \/home\/forge\/default\/public\/index.php on line 24 \n

Fatal error: require(): Failed opening required ‘\/home\/forge\/default\/public\/..\/vendor\/autoload.php’ (include_path=’.:\/usr\/share\/php’) in \/home\/forge\/default\/public\/index.php on line 24 \n

(Using MySQLWorkbench with SSH, i also cant see any tables migrated) \n

It started generating dependencies and failed with :\n’\nIn PackageManifest.php line 165: \n

‘cd \/home\/forge\/default \n

git pull origin master \n

composer dump-autoload \n

composer install \n

but still the same error :\n’In PackageManifest.php line 165: \n

The \/home\/forge\/default\/bootstrap\/cache directory must be present and writa\nble. \n

Hmm, that is odd. First, I never recommend using the default site because you will have problems with SSL site verification. One thing you could do is create a second site with your site name like example.com and setup up everything and see if you have the same issues. If it’s fine then use that and delete the default site. Otherwise, you know it is either your repo or the forge server. \n»,»bodyInMarkdown»:»Hmm, that is odd. First, I never recommend using the default site because you will have problems with SSL site verification. One thing you could do is create a second site with your site name like `example.com` and setup up everything and see if you have the same issues. If it’s fine then use that and delete the default site. Otherwise, you know it is either your repo or the forge server.»,»replies»:[],»user»:<"id":19919,"username":"ejdelmonico","avatar":"\/\/unavatar.now.sh\/github\/ejdelmonico","experience":<"award_count":"288","level":50,"points":"357,005","pointsUntilNextLevel":"0">,»achievements»:[],»reported»:null,»profile»:<"github":"ejdelmonico","twitter":"ejdelmonico","full_name":null,"website":"https:\/\/edwarddelmonico.com","bio":null>,»dateSegments»:<"created_diff":"6 years ago">>,»likes»:[],»created_at»:»2018-05-26T15:23:43.000000Z»,»links»:<"delete":"\/discuss\/replies\/427940","like":"\/discuss\/replies\/427940\/likes","best_answer":"\/discuss\/conversations\/86961\/best">,»best_answer»:false,»dateSegments»:<"createdDiff":"3 years ago">>,<"id":428094,"conversation_id":86961,"body":"

I managed to go a little further in installation but now failing with 404 not found : \n

1)Install project without dependencies otherwise it fails \n

2)Deploy script used : \n

deployment fails but the folder ‘storage’ get created and accessible. \n

3)I create with mkdir the missing folders frameworks, cache, views and sessions in folder storage. \n

4)Deploying : no deployment error (nothing to migrate message) message but error 404 \n

5)so modifying the NGINX file:\nReplace the \n

listen 80;\nlisten [::]:80;\nby\nlisten 80 default_server;\nlisten [::]:80 default_server; \n

Result : I got the Laravel formatted text : » Whoops, looks like something went wrong. » so it is getting closer to site working but still not. \n

As the site is working on my local server, i would like to know which files are different and need to be checked usually on the production server? \n

For example the.env file of production server : is it normal to have following?\nAPP_URL=http:\/\/localhost \nDB_CONNECTION=mysql\nDB_HOST=127.0.0.1\nDB_PORT=3306 \n

Well, for production, I usually change the APP_URL to match the site url so that the project base path is correct. For the DB, yes, those are the normal values for MySQL in Ubuntu server. On a side note, Forge provisioning does all of the Nginx configurations for you, you shouldn’t have to modify it except to add more aggressive caching. Essentially, you shouldn’t have to do any modifications except to setup the deployment process. Are you installing Laravel differently than what is expected by Forge? I have many servers managed by Forge and the only issue that ever pops up is whether or not to do a composer install (which you would not with Spark). \n»,»bodyInMarkdown»:»Well, for production, I usually change the `APP_URL` to match the site url so that the project base path is correct. For the DB, yes, those are the normal values for MySQL in Ubuntu server. On a side note, Forge provisioning does all of the Nginx configurations for you, you shouldn’t have to modify it except to add more aggressive caching. Essentially, you shouldn’t have to do any modifications except to setup the deployment process. Are you installing Laravel differently than what is expected by Forge? I have many servers managed by Forge and the only issue that ever pops up is whether or not to do a composer install (which you would not with Spark).»,»replies»:[],»user»:<"id":19919,"username":"ejdelmonico","avatar":"\/\/unavatar.now.sh\/github\/ejdelmonico","experience":<"award_count":"288","level":50,"points":"357,005","pointsUntilNextLevel":"0">,»achievements»:[],»reported»:null,»profile»:<"github":"ejdelmonico","twitter":"ejdelmonico","full_name":null,"website":"https:\/\/edwarddelmonico.com","bio":null>,»dateSegments»:<"created_diff":"6 years ago">>,»likes»:[],»created_at»:»2018-05-29T10:34:11.000000Z»,»links»:<"delete":"\/discuss\/replies\/428638","like":"\/discuss\/replies\/428638\/likes","best_answer":"\/discuss\/conversations\/86961\/best">,»best_answer»:false,»dateSegments»:<"createdDiff":"3 years ago">>,<"id":428665,"conversation_id":86961,"body":"

1)Install the site without composer dependencies otherwise install failure\n=> site installed but the storage folder is not present \n

But still the site is not displaying : 404 not found \n \n \n

6)Site is live by IP address (Still the issue that it doesnt work with the hostname configured in the registrar) \n

I did this process many times removing some steps or writing everything in the deploy script without using the ssh cli command but then it will fail. \n

Can you please provide an example of your gitignore file?\nI feel it is not normal that following folders are excluded in my gitignore causing so errors: \n

Here is a typical one that I use in a Laravel project: \n

Ok, it makes sense. \n

If you exclude your public from git, it means you have to run npm on server, as i had to do to generate the contents after creating these missing folders. (I didnt have the \/ of \/public, this might be the reason why the empty folder didnt exist in my git so i had to create them through ssh before running npm) \n

I understand there are 2styles :\nPeople who want to run npm locally and include the public assets in their git and other people who exclude these folders but run npm on server.\nThanks for you patience \n»,»bodyInMarkdown»:»Ok, it makes sense.\r\n\r\nIf you exclude your public from git, it means you have to run npm on server, as i had to do to generate the contents after creating these missing folders. (I didnt have the \/ of \/public, this might be the reason why the empty folder didnt exist in my git so i had to create them through ssh before running npm)\r\n\r\nI understand there are 2styles :\r\nPeople who want to run npm locally and include the public assets in their git and other people who exclude these folders but run npm on server.\r\nThanks for you patience\r\n»,»replies»:[],»user»:<"id":111000,"username":"Dave97","avatar":"\/\/www.gravatar.com\/avatar\/a07cd4da3d22aaa98ce67cf51dc00671?s=100&d=https%3A%2F%2Fs3.amazonaws.com%2Flaracasts%2Fimages%2Fforum%2Favatars%2Fdefault-avatar-10.png","experience":<"award_count":"0","level":1,"points":"3,740","pointsUntilNextLevel":"1,260">,»achievements»:[],»reported»:null,»profile»:<"github":"","twitter":"","full_name":null,"website":"","bio":null>,»dateSegments»:<"created_diff":"3 years ago">>,»likes»:[],»created_at»:»2018-05-29T17:13:52.000000Z»,»links»:<"delete":"\/discuss\/replies\/428742","like":"\/discuss\/replies\/428742\/likes","best_answer":"\/discuss\/conversations\/86961\/best">,»best_answer»:false,»dateSegments»:<"createdDiff":"3 years ago">>,<"id":428745,"conversation_id":86961,"body":"

I understood the issue, the culprit are the following files in my gitignore : \n

With above instructions each folder with its content is excluded from git and not pushed in my bucket.So the reason why i had to re create them through SSH. \n

It seems also that Forge do a npm run install, npm run production automatically during the deployment as the folders are populated on the server.\nSo no need to run this command manually anymore. \n

Here is a typical one that I use in a Laravel project: \n

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *