지정된 응용 프로그램 암호화 키가 없습니다
나는 Laravel을 처음 사용하고 장인 명령을 사용하려고합니다 ...
php artisan serve
표시됩니다 ...
라 라벨 개발 서버 시작 : http://127.0.0.1:8000
그러나 자동으로 시작되지 않으며 http://127.0.0.1:8000을 수동으로 입력 하면 다음 오류가 표시됩니다.
RuntimeException 응용 프로그램 암호화 키가 지정되지 않았습니다.
어떤 아이디어? Laravel 프레임 워크 5.5-dev를 사용하고 있습니다.
에서 암호화 - Laravel - PHP의 프레임 워크에 대한 웹 장인 :
"Laravel의 암호화기를 사용하기 전에 config / app.php 구성 파일에서 키 옵션을 설정해야합니다.
php artisan key:generate이 키를 생성 하려면 명령을 사용해야합니다 "
google.com 에서이 복잡한 인터넷 쿼리를 사용하는 것을 발견했습니다.
"laravel add encrption key"(예, 오타에서도 작동했습니다!)
필자의 경우 캐시 된 구성 파일을 재설정해야했습니다.
php artisan key:generate
php artisan config:cache
프로젝트의 루트 폴더에서 명령 프롬프트를 열고 아래 명령을 실행하십시오.
php artisan key:generate
응용 프로그램에 대한 응용 프로그램 키를 생성합니다.
생성 된 애플리케이션 키 (APP_KEY)는 .env파일 에서 찾을 수 있습니다 .
이 명령을 실행하면됩니다.
php artisan key:generate
복사
.env.example하기.env:cp -a .env.example .env키를 생성하십시오.
php artisan key:generate그런 다음에 만 실행하십시오.
php artisan serve
cp .env.example .env.env 파일이없는 경우 php artisan key:generate명령이 나를 위해 작동합니다. 암호화 키를 생성합니다
실제로 프로젝트에 .env 파일 을 추가 한 다음 작동 하도록 .env.example 의 내용을 복사해야 key:generate했습니다. 프로젝트를 시작할 때 .env 파일이 생성되지 않은 이유를 잘 모르겠습니다 .
php artisan key:generate
php artisan config:cache
나를 위해 일했지만 Windows의 명령 프롬프트에서 수행해야했습니다.
PHPStorm의 터미널 내에서 작동하지 않았습니다.
라 라벨 애플리케이션에서 작업 할 때 발생할 수있는 일반적인 문제는 예외입니다.
RuntimeException 응용 프로그램 암호화 키가 지정되지 않았습니다.
.env.example파일을 복사 .env하지만 APP_KEY변수 값을 설정하지 않는 기존 라 라벨 애플리케이션을 풀다운 할 때 종종이 문제가 발생합니다 .
명령 행에서 다음 Artisan 명령을 실행하여 키를 생성하십시오.
php artisan key:generate
에 대한 임의의 키가 생성됩니다. 편집 APP_KEY완료 후 .env캐시에서 캐시를 지우려면 다음 명령을 터미널에 입력하십시오.php artisan config:cache
Also, If you are using the PHP's default web server (eg. php artisan serve) you need to restart the server changing your .env file values. now you will not get to see this error message.
Follow this steps:
php artisan key:generatephp artisan config:cachephp artisan serve
Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:
- Rename or copy/rename .env.example file in the root of your project to .env.
You should not just create empty .env file, but fill it with content of .env.example.
- In the terminal go to the project root directory(not public folder) and run
php artisan key:generate
- If everything is okay, the response in the terminal should look like this
Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=] set successfully.
- Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:
APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=
- In terminal run
php artisan config:cache
That's it.
You can generate Application Encryption Key using this command:
php artisan key:generate
Then, create a cache file for faster configuration loading using this command:
php artisan config:cache
Or, serve the application on the PHP development server using this command:
php artisan serve
That's it!
If you git clone some project then this kind of issue may usually occur.
- make sure there is
.envfile - run
php artisan key:generateand then it should generate APP_KEY in .env - finally run
php artisan serveand it should be working.
I ran into this issue when I manually copied the contents of my Laravel project (say sites/oldname) into a new directory on my Mac (say, sites/newname). Since I was manually dragging and droppping, it didn't grab the hidden files, namely, '.env'. When I looked more closely at sites/oldname I saw .editorconfig, .env, .env.example, .gitatrributes, .styleci.yml, etc.
The error went away once I copied the hidden files to the new directory.
So, "No Application Encryption Key Has Been Specified" is Laravel speak for "your .env file is missing."
I had to restart my queue worker using php artisan queue:restart after running php artisan key:generate to get jobs working.
참고URL : https://stackoverflow.com/questions/44839648/no-application-encryption-key-has-been-specified
'IT story' 카테고리의 다른 글
| SQL Server에서 올바른 트랜잭션 사용 (0) | 2020.04.30 |
|---|---|
| DbContext.Database.ExecuteSqlCommand 메서드에 매개 변수를 전달하는 방법은 무엇입니까? (0) | 2020.04.30 |
| Vim에서 분할 창 취소 (0) | 2020.04.30 |
| Django에서 날짜 범위별로 쿼리 객체를 어떻게 필터링합니까? (0) | 2020.04.30 |
| HTTP POST가 오류 : 417“예상 실패”를 반환합니다. (0) | 2020.04.30 |