Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

RuntimeException The only supported ciphers are AES-128-CBC and AES-256-CBC(...)

Olá, seguindo o vídeo da aula 2 estou encontrando este erro

RuntimeException 
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
in Encrypter.php (line 43)

Já verifiquei e no arquivo em config/app.php o já esta assim " cipher' => 'AES-128-CBC' " , já estei colocando o outro valor sugerido pelo erro (AES-256-CBC) e não funcionou ... No Arquivo ProdutoController.php eu já testei das duas formas ... usando o caminho direto(use Illuminate\Support\Facades\DB;) e somente o simples (use DB;) e ambos o erro continua ; O Arquivo env eu já testei deixar somente como esta na aula ou inteiro como o env.example alterando os valores referentes a DATABASE ou removendo os mesmo porém o erro continua ... estou usando a ultima versão do laravel pois quando usei a versão do curso estava com bastantes erros que sempre quando eu ia buscar em algum fórum me recomendavam usar a versão + nova ... Toda mudança que eu faço eu paro o servidor e dou um " php artisan config:clear " To quase desistindo de laravel já :(


ProdutoController.php

<?php 
namespace estoque\Http\Controllers;
use DB;

class ProdutoController extends Controller{
    public function lista(){
        $produtos = DB::select('select * from produtos');
        dd($produtos);
        return "<h1>Listagem de Produtos</h1>";
    }
}


?>

config/app.php

 'cipher' => 'AES-128-CBC',

( estou usando o WTserver .. ele acaba usando por padrão o mariadb como banco de dados e o ngix pra servidor web) config/database.php

      'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'estoque_laravel'),
            'username' => env('DB_USERNAME', 'root'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

Erro completo:

(1/1) RuntimeException 
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
in Encrypter.php (line 43)
at Encrypter->__construct('', 'AES-128-CBC')
in EncryptionServiceProvider.php (line 27)
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array())
in Container.php (line 726)
at Container->build(object(Closure))
in Container.php (line 608)
at Container->resolve('encrypter')
in Container.php (line 575)
at Container->make('encrypter')
in Application.php (line 728)
at Application->make('encrypter')
in Container.php (line 862)
at Container->resolveClass(object(ReflectionParameter))
in Container.php (line 790)
at Container->resolveDependencies(array(object(ReflectionParameter)))
in Container.php (line 757)
at Container->build('estoque\\Http\\Middleware\\EncryptCookies')
in Container.php (line 608)
at Container->resolve('estoque\\Http\\Middleware\\EncryptCookies')
in Container.php (line 575)
at Container->make('estoque\\Http\\Middleware\\EncryptCookies')
in Application.php (line 728)
at Application->make('estoque\\Http\\Middleware\\EncryptCookies')
in Pipeline.php (line 138)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Router.php (line 576)
at Router->runRouteWithinStack(object(Route), object(Request))
in Router.php (line 535)
at Router->dispatchToRoute(object(Request))
in Router.php (line 513)
at Router->dispatch(object(Request))
in Kernel.php (line 174)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in ValidatePostSize.php (line 27)
at ValidatePostSize->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Kernel.php (line 149)
at Kernel->sendRequestThroughRouter(object(Request))
in Kernel.php (line 116)
at Kernel->handle(object(Request))
in index.php (line 53)
at require_once('C:\\WTServer\\WWW\\estoque\\public\\index.php')
in server.php (line 21)
1 resposta
solução!

PS: CONSEGUI RESOLVER ... Pra quem estiver com o mesmo problema só copiar o env.example para o env e lá alterar as informações referentes ao banco de dados. Então parar o servidor digitando CTRL+C onde estiver aberto, e digita php artisan key:generate , então só iniciar novamente . Fonte:https://github.com/laravel/framework/issues/9080 na resposta do andrewtweber

" In config/app.php I have 'cipher' => 'AES-128-CBC', In my .env file I have APP_KEY of length 32 characters. I am getting the same error as above. I also tried php artisan key:generate, which created a new key of length 16 characters, but it still has the same error message. "