lonnieezell / myth-auth

One-stop Auth package for CodeIgniter 4
MIT License
633 stars 206 forks source link

Migate success with error #298

Closed futag closed 3 years ago

futag commented 3 years ago

if migrating myth auth using php spark migrate -all showing error like this

`An uncaught Exception was encountered

Type: CodeIgniter\Database\Exceptions\DatabaseException Message: Unable to connect to the database. Filename: C:\xampp\htdocs\1cak-new\vendor\codeigniter4\framework\system\Database\BaseConnection.php Line Number: 425`

and env is correct

cseoneohs commented 3 years ago

Hello, i have exactly the same problem.

cseoneohs commented 3 years ago

In fact the tables had been created ! But still have the message "An uncaught Exception was encountered...

sandrocantagallo commented 3 years ago

So...

Short answer:

in your PHP.ini check for:

extension=sqlite3

You need this library in codeigniter 4 in order to use FORGE.

Long answer:

Open: app\Config\Logger.php

Set to 9 logging level

/*
    |--------------------------------------------------------------------------
    | Error Logging Threshold
    |--------------------------------------------------------------------------
    |
    | You can enable error logging by setting a threshold over zero. The
    | threshold determines what gets logged. Any values below or equal to the
    | threshold will be logged. Threshold options are:
    |
    |   0 = Disables logging, Error logging TURNED OFF
    |   1 = Emergency Messages  - System is unusable
    |   2 = Alert Messages      - Action Must Be Taken Immediately
    |   3 = Critical Messages   - Application component unavailable, unexpected exception.
    |   4 = Runtime Errors      - Don't need immediate action, but should be monitored.
    |   5 = Warnings               - Exceptional occurrences that are not errors.
    |   6 = Notices            - Normal but significant events.
    |   7 = Info             - Interesting events, like user logging in, etc.
    |   8 = Debug                - Detailed debug information.
    |   9 = All Messages
    |
    | You can also pass an array with threshold levels to show individual error types
    |
    |   array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
    |
    | For a live site you'll usually enable Critical or higher (3) to be logged otherwise
    | your log files will fill up very fast.
    |
    */
    public $threshold = 9;

Now redo migration...and go to:

writable\logs

for see logs. You will find in the last log:

ERROR - 2020-11-25 23:27:39 --> Error connecting to the database: Class 'SQLite3' not found
CRITICAL - 2020-11-25 23:27:39 --> Unable to connect to the database.

If you active the library and redo migration you will see something like:

Running all new migrations... Running: (Myth\Auth) 2017-11-20-223112_Myth\Auth\Database\Migrations\CreateAuthTables Done

AfterAll this error don't block the library and table in DB are saved.

MGatner commented 3 years ago

This is not a Myth issue. If sandrocantagallo 's fix does not work for you check this thread for solutions: https://github.com/codeigniter4/CodeIgniter4/issues/3359

If the problem persists please add to that thread or open a new issue at the framework's repo.

@lonnieezell this can close.

MGatner commented 3 years ago

@lonnieezell bump closure request