Error: No supported Encrypter found. The Cipher and / or key length are invalid

Asked

Viewed 842 times

1

Personal I am using Laravel 5.2 and went to perform an authentication, but when I run the command php artisan make:auth works perfectly, but in practice does not... When I click on login or Register give me this error :

No supported Encrypter found. The Cipher and / or key length are invalid.

How can I fix it? Composer.json :

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*"

    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}
  • friend installed by Composer, is mac and has permission ... but my file . env neither the .env.exemple exists ,,,,

  • strange that no project of mine has .env... I will post my Composer.json

  • Friend sorry I did not understand the commands... I just created another project for testing and also came without the .env.exemple .... Ondep bone tidy ?

  • I followed the tuturial in the own site of Aravel ... I did everything in my root folder ... to create the project I used Composer create-project Aravel/Aravel

  • within the Composer folder there are several files, cache, vendor, Composer .joson... some of them are ?

  • I ran Curl and everything .... I gave the command as said ...now came . env, I will test auth

  • @Guilhermenascimento worked also ... Pro Favor creates an answer to give as resolved ....

  • 1

    @Guilhermenascimento that good ... Thank you very much ....

Show 3 more comments

2 answers

2


Navigated to the project folder and there is no .env.example is because there was some fault in the installation of Laravel, when we first installed Laravel by Composer it generates a copy inside the Composer folder, then create new projects (probably by artesian) it fetches from the local copy, check the folder that has been installed, usually the location that gets saved is the ~/.composer/vendor/bin, if you think something failed in the installation of Composer, use the command this way:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

When creating a project use the parameter --prefer-dist, thus:

composer create-project --prefer-dist laravel/laravel meuprimeiroprojeto

To check if everything is ok, navigate to the folder typing:

cd meuprimeiroprojeto
ls -a

Will display all files, should appear the .env.example

0

First of all, you must generate your APP_KEY:

php artisan key:generate

If it’s still not working, check the file config/app.php if it is defined as:

'cipher' => 'AES-256-CBC'

What if the file .env there is... if not, you should rename the .env.example for .env

  • friend . env n exists right where I create ? because neither . env nor .env.exemple encounter ?

  • the file .env.exemple or the very .env is at the root of the project... remembering that in linux the files that start with . are hidden, to edit them just run the nano . env

  • I’ve tried to see in the occult and nothing either ....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.