require (vendor / autoload.php) : 스트림을 열지 못했습니다.
이 문제가 여러 번 게시되었음을 알고 있지만 나에게는 다른 문제인 것 같습니다.
실제로이 오류는
경고 : require (vendor / autoload.php) : 스트림을 열지 못했습니다. 3 행의 C : \ xampp \ htdocs \ site_web \ send_mail.php에 해당 파일 또는 디렉토리가 없습니다.
치명적인 오류 : require () : 3 행의 C : \ xampp \ htdocs \ site_web \ send_mail.php에서 필수 'vendor / autoload.php'(include_path = 'C : \ xampp \ php \ PEAR')를 열지 못했습니다.
이 줄에서 내 코드 시작 부분에 나타납니다.
require 'vendor/autoload.php';
그래서 내 컴퓨터 어딘가에 /vendor/autoload.php 파일이 있어야한다고 생각합니다 (나는 composer를 설치하고 실행했습니다 composer require phpmailer/phpmailer
).
그래서 dir /s autoload.php
Windows 명령 줄에서 다음을 사용하여이 파일을 찾았고 여기에서 하나를 찾았습니다. C:\Windows\SysWOW64\vendor\autoload.php
,
하지만 나를 위해 syswow64 폴더에는 autoload.php로 볼 것이 없습니다. 여기서 누락 된 내용을 볼 수 없습니다.
누락 된 것은 실행 중이며 composer install
패키지를 가져오고 자동로드 스크립트와 함께 공급 업체 폴더를 만듭니다.
상대 경로가 올바른지 확인하십시오. 예를 들어 PHPMailer의 예제 스크립트 examples/
는 프로젝트 루트 아래에 있으므로 작성기 자동 로더를로드하기위한 올바른 상대 경로는 ../vendor/autoload.php
.
당신이 찾은 autoload.php C:\Windows\SysWOW64\vendor\autoload.php
는 아마도 글로벌 컴포저 설치 일 것입니다. 일반적으로 phpcs, phpunit, phpmd 등을 넣을 것입니다.
composer update
같은 일이 아니며, 아마 하지 사용할 것을 - 당신의 코드가 현재 패키지 버전은 다음 실행 테스트하는 경우 update
추가 작업 및 테스트가 필요할 수 있습니다 파손을 일으킬 수 있으므로 실행하지 않는 update
당신에게 특별한 이유가 없다면. 더 명확히하기 위해 composer update
서버에서가 아니라 로컬 로만 실행 해야합니다.
나는 종종 사람들이 컴포저를 서버에서 실행할 수 없기 때문에 사용할 수 없다는 불만을 봅니다 (예 : 공유되고 쉘 액세스 권한이 없기 때문에). 이 경우 에도 여전히 composer를 사용할 수 있습니다. 로컬에서 실행하고 (이러한 제한이없는 환경) 다른 모든 PHP 스크립트와 함께 생성되는 로컬 공급 업체 폴더를 업로드합니다.
실행할 때도 오류가 발생하면
composer install
이 명령을 먼저 실행하십시오.
composer dump-autoload
이 명령은 모든 컴파일 된 파일과 해당 경로를 정리합니다.
@Bashir는 거의 나를 도왔지만 필요했습니다.
composer update --no-scripts
먼저 작곡가를 설치했는지 확인하십시오.
composer install
이미 설치 한 경우 작성기를 업데이트하십시오.
composer update
적절한 autoload.php
구성 :
A) 빠른 답변 :
autoload.php 경로가 잘못되었습니다. 즉. C:\Windows\SysWOW64\vendor\autoload.php
현재까지 : 다음으로 변경해야합니다.C:\Users\<Windows User Name>\vendor\autoload.php
B) 단계와 예 : 우리는 걸릴 북 / PHP 그래프-SDK 일례로서 단계; Package Name
필요에 따라로 변경하십시오 .
- composer.exe 설치
- CMD 프롬프트를 엽니 다.
+ R+ 유형
CMD
- 이 명령을 실행하십시오.
composer require facebook/graph-sdk
- PHP 페이지에 경로 포함 :
require_once 'C:\Users\<Windows User Name>\vendor\autoload.php';
- 구성
Secrets
및Access Token
패키지 등을 정의하십시오 . - 행복한 코디 니그.
C) 추가 세부 사항 :
Windows에 composer를 설치하면 패키지에이 기본 경로가 설정됩니다. 거기에서 찾을 수 있으며 오토로더 경로를 포함 할 수 있습니다.
C:\Users\<Windows User Name>\vendor
당신이 물었던 것과 같은 질문에 대해; 대답은 Windows 용 WAMP Server 64 BIT 의이 경로였습니다 .
그런 다음 PHP 애플리케이션에서 다음을 변경하십시오.
require_once __DIR__ . '/vendor/autoload.php';
에:
require_once 'C:\Users\<Windows User Name>\vendor\autoload.php';
아래에서 Windows 사용자 이름을 찾으십시오.C:\Users\
이 모든 작업을 수행하기 전에 B)에서 언급했듯이 다음 명령을 실행해야합니다.
composer require <package name>
예를 들어 facebook php SDK의 경우 :
composer require facebook/graph-sdk
이 질문을 해주셔서 감사합니다. 비슷한 문제를 해결하는 데 도움이되었고이 간단한 자습서 작성을 마쳤 기 때문에 감사했습니다.
내 컴퓨터에 다음 경로가 있습니다.
C:/xampp5.0/htdocs/project-recordando-symfony/project-recordando-symfony
Then I ran composer install
or/and composer update
and it returned this error:
ErrorException ZipArchive::extractTo...
That error is because your path is too much long, I changed to:
C:/xampp5.0/htdocs/p-symfony/*
and worked!
If you have cloned your project from Github or got it from somewhere else, you will encounter this error. That's because you are missing the vendor folder and other files. The vendor folder contains packages which are dependent to your project. The package dependencies are stored in composer.json
file and the folder was excluded while pushing to Github.
Fix this error by simply running:
composer install
Then you will get all the assets needed for your project.
This problem happened with me when I clone projects from git and wanna run for the first time. I ran composer install
in the directory and its work for me.
I was able to resolve by removing composer and reinstalling the proper way. Here is what I did:
- sudo apt remove composer
- sudo apt autoclean && sudo apt autoremove
- Installed globally with the instructions from: https://getcomposer.org/doc/00-intro.md Download from: https://getcomposer.org/installer global install: mv composer.phar /usr/local/bin/composer (Note: I had to move mine to mv composer.phar /usr/bin/composer)
I was then able to get composer install to work again. Found my answer at the bottom of this issue: https://github.com/composer/composer/issues/5510
First, review route inside index.php
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
in my case the route did not work, I had to review the directories.
run composer update
. That's it
In your project folder, the vendor folder is missing so you got this error:
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in
When you download the project through git, the project is downloaded without the vendor folder
You need /vendor
because all your packages are there, including all the classes Laravel uses. The vendor directory contains your Composer dependencies.
The solution is simple, Just run this command:
composer update --no-scripts
composer update
composer update --no-scripts
It will Skips execution of scripts defined incomposer.json
file.composer update
It will update your depencencies as they are specified incomposer.json
file.
With this command, you will re-create the vendor folder in your project and after that your project will start working normally.
Change the auto_prepend_file property on php.ini
; Automatically add files before PHP document.
;http://php.net/auto-prepend-file
auto_prepend_file =
참고URL : https://stackoverflow.com/questions/41209349/requirevendor-autoload-php-failed-to-open-stream
'programing tip' 카테고리의 다른 글
Linux 프로세스 상태 (0) | 2020.09.18 |
---|---|
GCC 및 Clang 파서는 실제로 손으로 작성됩니까? (0) | 2020.09.18 |
Angular 2의 특정 경로에 대해 RouteReuseStrategy shouldDetach를 구현하는 방법 (0) | 2020.09.18 |
Android Gradle 3.0.0-alpha2 플러그인, 읽기 전용 속성 'outputFile'의 값을 설정할 수 없습니다. (0) | 2020.09.18 |
터미널에서 bash 스크립트를 어떻게 실행합니까? (0) | 2020.09.18 |