laravel 安装获取密钥在 ubunto OS 中生成错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36276767/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel install getting key generate error in ubunto OS
提问by Balaguru Murugan
I am install "Laravel Framework version 5.2.26" but i am getting error for key generate in my ubuntu os
我正在安装“Laravel Framework 5.2.26 版”,但在我的 ubuntu 操作系统中生成密钥时出现错误
user@CN43:/var/www/html/laravel_1$ php artisan key:generate
[ErrorException]
file_get_contents(/var/www/html/laravel_1/.env): failed to open stream: No
such file or directory
So i have check that directory .env file is not there but .env.example file only there so i created that file and update database name, database username, database password after that "php artisan key:generate" command is worked that key was generated above 32 characters and its get [base64:somethingsstrings with above 32 characters] i think some installation issues is there.
所以我检查了那个目录 .env 文件不存在,但 .env.example 文件只在那里,所以我创建了那个文件并更新数据库名称、数据库用户名、数据库密码,然后“php artisan key:generate”命令工作该密钥是生成超过 32 个字符并得到 [base64:somethingsstrings with above 32 characters] 我认为存在一些安装问题。
my laravel site is not opening. what i do mistake?
我的 Laravel 网站打不开。我做错了什么?
回答by Alexey Mezenin
Rename .env.example
to .env
and fill all properties.
重命名.env.example
到.env
并填写所有属性。
If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually
如果你通过 Composer 安装 Laravel,这个文件会自动重命名为 .env。否则,您应该手动重命名文件
https://laravel.com/docs/5.0/configuration#environment-configuration
https://laravel.com/docs/5.0/configuration#environment-configuration
回答by Hiren Gohel
Run this command and make .env file from .env.example file:
运行此命令并从 .env.example 文件制作 .env 文件:
cp .env.example .env
php artisan key:generate
Now it's generate the key. Don't create new .env file.
现在它生成了密钥。不要创建新的 .env 文件。