9
respostas

erro ao gravar serie

boa tarde, eu subistitui meu projeto com o projeto final do curso, agora nao consigo o fluxo completo da aplicacao....o erro e , bom nao me recordo se ja estava com o erro antes tambem...rs

Illuminate \ Database \ QueryException
could not find driver (SQL: PRAGMA foreign_keys = ON;)
Previous exceptions
could not find driver (0)

D:\Users\rafael.lara\Documents\PROJETOS\LARAVEL ALURA\controle-series\vendor\laravel\framework\src\Illuminate\Database\Connection.php
     * @param  array     $bindings
     * @param  \Closure  $callback
     * @return mixed
     *
     * @throws \Illuminate\Database\QueryException
     */
    protected function runQueryCallback($query, $bindings, Closure $callback)
    {
        // To execute the statement, we'll simply call the callback, which will actually
        // run the SQL against the PDO connection. Then we can calculate the time it
        // took to execute and log the query SQL, bindings and time in our memory.
        try {
            $result = $callback($query, $bindings);
        }

        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (Exception $e) {
            throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );
        }

        return $result;
    }

    /**
     * Log a query in the connection's query log.
     *
     * @param  string  $query
     * @param  array   $bindings
     * @param  float|null  $time
     * @return void
     */
    public function logQuery($query, $bindings, $time = null)
    {
        $this->event(new QueryExecuted($query, $bindings, $time, $this));

        if ($this->loggingQueries) {
Arguments
"could not find driver (SQL: PRAGMA foreign_keys = ON;)"
9 respostas

Oi Rafael, tudo bom?

O erro:

Illuminate \ Database \ QueryException
could not find driver (SQL: PRAGMA foreign_keys = ON;)
Previous exceptions
could not find driver (0)

Costuma indicar a falta da extensão php_pdo no seu sistema operacional.

Se você usa linux, basta executar o comando:

sudo apt-get install php-pdo

pra garantir, você também pode rodar o do mysql:

sudo apt-get install php-mysql

Se você usa windows, vai no seu php.ini e descomenta a linha da extensão php-pdo depois reinicia seu apache.

Acredito que tendo essa extensão habilitada seu erro, pelo menos, vai mudar =)

Qualquer coisa é só falar

Abraço!

Oi, Rafael.

Como o André comentou, esse erro indica que você não tem o driver de conexão com o banco habilitado. Como nós estamos utilizando SQLite, basta habilitar a extensão pdo_sqlite.

Se você estiver no Windows, basta descomentar (remover o ; do início) a linha que contenha extension=pdo_sqlite no seu arquivo php.ini .

Como nós trabalhamos com o servidor embutido do próprio PHP, basta apertar Ctrl + C para pará-lo e iniciá-lo de novo para ver as alterações.

Mas, antes, com seu código, estava funcionando? Me passa mais detalhes sobre sua plataforma?

bom dia pessoal, então.... estou usando o win 10 e mexendo na pasta do php meu erro mudou:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

e esse

D:\Users\rafael.lara\Documents\PROJETOS\LARAVEL ALURA\controle-series\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php
     * @param  string  $cipher
     * @return string
     */
    public static function generateKey($cipher)
    {
        return random_bytes($cipher === 'AES-128-CBC' ? 16 : 32);
    }

    /**
     * Encrypt the given value.
     *
     * @param  mixed  $value
     * @param  bool  $serialize
     * @return string
     *
     * @throws \Illuminate\Contracts\Encryption\EncryptException
     */
    public function encrypt($value, $serialize = true)
    {
        $iv = random_bytes(openssl_cipher_iv_length($this->cipher));

        // First we will encrypt the value using OpenSSL. After this is encrypted we
        // will proceed to calculating a MAC for the encrypted value so that this
        // value can be verified later as not having been changed by the users.
        $value = \openssl_encrypt(
            $serialize ? serialize($value) : $value,
            $this->cipher, $this->key, 0, $iv
        );

        if ($value === false) {
            throw new EncryptException('Could not encrypt the data.');
        }

        // Once we get the encrypted value we'll go ahead and base64_encode the input
        // vector and create the MAC for the encrypted value so we can then verify
        // its authenticity. Then, we'll JSON the data into the "payload" array.
        $mac = $this->hash($iv = base64_encode($iv), $value);

        $json = json_encode(compact('iv', 'value', 'mac'));

Arguments
"Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()"

Oi, Rafael. Muito estranho. Normalmente no Windows a extensão de openssl já vem habilitada.

De qualquer forma, basta ir no seu arquivo php.ini e descomentar a linha extension=php_openssl.

entao, pior q ja fiz isso.. e o erro continua o mesmo...

vou reinstalar aqui pra ver

Sua linha extension_dir = "ext" tá descomentada também?

Olá, Rafael!

Conseguiu solucionar?

na verdade nao... rsrss

Sua linha linha extension_dir = "ext" está descomentada?

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software