php 哎呀,看起来出事了。Laravel 5.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28893710/
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
Whoops, looks like something went wrong. Laravel 5.0
提问by jemz
I installed Laravel 5.0 properly by cloning in git, and composer install, when I ran it to browser http://localhost/laravel/public/
, it says
我通过在 git 中克隆和 composer install 正确安装了 Laravel 5.0,当我将它运行到浏览器时http://localhost/laravel/public/
,它说
"Whoops, looks like something went wrong."
“哎呀,看起来出事了。”
I did not make any changes after composer install.
安装 composer 后我没有做任何更改。
Updateafter copy the env.example to .env this is result
将 env.example 复制到 .env 后更新,这是结果
RuntimeException in compiled.php line 5599: OpenSSL extension is required.
compiled.php 第 5599 行中的 RuntimeException:需要 OpenSSL 扩展。
回答by kylehyde215
The logs are located in storage
directory. If you want laravel to display the error for you rather than the cryptic 'Whoops' message, copy the .env.example
to .env
and make sure APP_ENV=local
is in there. It should then show you the detailed error messaging.
日志位于storage
目录中。如果您希望 laravel 为您显示错误而不是神秘的“Whoops”消息,请复制.env.example
到.env
并确保APP_ENV=local
在那里。然后它应该向您显示详细的错误消息。
回答by Tausif Anwar
This is happening because there is a field in .env
file named, APP_KEY, which is blank now, we need some random key for this variable.
发生这种情况是因为.env
文件中有一个名为APP_KEY的字段,它现在是空白的,我们需要这个变量的一些随机键。
Follow these steps to get rid of this problem.
请按照以下步骤解决此问题。
1) .env.example
to .env
1) .env.example
到.env
2) Go to your root directory in your command prompt (If you are using windows)/terminal (If you are using MAC or LINUX) where you have installed laravel project/files and run following command
2)在你安装了laravel项目/文件的命令提示符(如果你使用的是Windows)/终端(如果你使用的是MAC或LINUX)中转到你的根目录并运行以下命令
php artisan key:generate
php artisan key:generate
and then run your project. It's all done.
然后运行你的项目。这一切都完成了。
回答by Yoseph
- Give write permission to storage and bootstrap/cache directories
- Rename .env.example file to .env
- If you get "RuntimeException... No supported encrypter found. The cipher and / or key length are invalid." error, stop the application and generate key from command line "php artisan key:generate"
- If your get "OpenSSL extension is required" error, enable the openssl extension by opening php.ini in php installation folder and uncommenting the line extension=php_openssl.dll by removing the semicolon at the beginning
- 授予存储和引导程序/缓存目录的写权限
- 将 .env.example 文件重命名为 .env
- 如果您收到“RuntimeException...未找到支持的加密器。密码和/或密钥长度无效。” 错误,停止应用程序并从命令行“php artisan key:generate”生成密钥
- 如果您收到“需要 OpenSSL 扩展”错误,请通过打开 php 安装文件夹中的 php.ini 并通过删除开头的分号取消注释 extension=php_openssl.dll 行来启用 openssl 扩展
回答by Rahul Hirve
Follow these steps to this problem for all versions of your laravel like laravel 5.5
对于所有版本的 Laravel,请按照以下步骤解决此问题,例如 laravel 5.5
Step: 1
第1步
Rename file .env.example
to .env
将文件重命名.env.example
为.env
Step: 2
第2步
Go to your Command prompt/terminal and change path to project directory. Generate key for your application. This is unique for every application so don't make copy paste.
转到您的命令提示符/终端并更改项目目录的路径。为您的应用程序生成密钥。这对于每个应用程序都是独一无二的,所以不要复制粘贴。
Just run the following command. Key will automatically save to your .env file
只需运行以下命令。密钥将自动保存到您的 .env 文件
php artisan key:generate
回答by Ethicalguy Gopal Bogati
Try to type in cmd:php artisan key:generate the problems will be solved
尝试输入cmd:php artisan key:generate 问题就解决了
回答by pavani
Simply type in terminal in your command prompt go to laravel directory path and type php artisan key:generate
then key will be generated. Paste that key in config/app.php
key variable. Your problem will be solved. I also did like that inorder
to solve the problem...
只需在命令提示符中输入终端,转到 laravel 目录路径并输入,php artisan key:generate
然后将生成密钥。将该键粘贴到config/app.php
键变量中。您的问题将得到解决。我也确实喜欢这样inorder
来解决问题...
回答by user7762065
In Laravel 5.5, I had the same issue
在 Laravel 5.5 中,我遇到了同样的问题
.env
was added to .gitignore.
已添加到 .gitignore。
So Either remove ".env" it from .gitignore file.
所以要么从 .gitignore 文件中删除“.env”它。
or add it forcefully
或者强行添加
git add .env -f
And Deploy it. It will work.
并部署它。它会起作用。
If above does not help. Try generating the Key Again
如果以上没有帮助。尝试再次生成密钥
php artisan key:generate
回答by lightup
Try this:
尝试这个:
sudo chown -R www-data pathto/.env
须藤 chown -R www-data pathto/.env
BECAUSE IF After Creating the .env file or/and Generating the Key by
因为如果在创建 .env 文件或/和通过以下方式生成密钥后
php artisan key:generate
just as explained previously by others, and it still persists Try the following:
正如其他人之前解释的那样,它仍然存在尝试以下操作:
ls path/.env -al
if apache doesn't have access to it by displaying
如果 apache 无法通过显示访问它
www-data
万维网数据
as one one of the users i mean like
作为用户之一,我的意思是喜欢
-rw-rwx--- 1 www-data rootuser 575 Nov 4 06:34 pathto/.env
-rw-rwx--- 1 www-data rootuser 575 Nov 4 06:34 pathto/.env
This as stated above should resolve it. Especially when your laravel.log file keeps complaining that the key hasn't been generated or added.
这如上所述应该解决它。特别是当您的 laravel.log 文件不断抱怨尚未生成或添加密钥时。
sudo chown -R www-data pathto/.env
须藤 chown -R www-data pathto/.env
回答by Indrajeet Singh
Go to project directory then follow below steps.
转到项目目录,然后按照以下步骤操作。
step 1: rename file .env.example `to .env
mv .env.example .env (for linux)
mv .env.example .env (Linux)
step 2: php artisan key:generate
回答by Nadimuthu Sarangapani
Check, which PHP version is running on your WAMP,XAMPP or LARAGAN server. It should be greater than 7.0.
检查您的 WAMP、XAMPP 或 LARAGAN 服务器上运行的是哪个 PHP 版本。它应该大于 7.0。
- Go to project folder like "C:\wamp\www\laravel".
- Open the file name of
.env.example
. (By using any editor like sublime, notepad++ and so on). - Save as a
.env
- 转到项目文件夹,如“C:\wamp\www\laravel”。
- 打开文件名
.env.example
. (通过使用任何编辑器,如 sublime、notepad++ 等)。 - 另存为
.env
Then run your LARAVEL program. Hope it will work.
然后运行你的 LARAVEL 程序。希望它会起作用。
You can check whether how to change the PHP version in your current server. xampp, wamp