sqlite could not find driver (SQL: PRAGMA foreign_keys = ON;)

  • | 156 points

    Hi im trying to run the example laravel test, I have set the data base values as

    <server name="DB_CONNECTION" value="sqlite"/>
    <server name="DB_DATABASE" value="database/testing.sqlite"/>

    in phpunit.xml. I am getting the error

    1. Tests\Feature\ExampleTest::testBasicTest
      Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA foreign_keys = ON;)

    I have enabled extensions sqlite3 and pdo_sqlite. Help would be appreciated

  • | 156 points

    I have also manual uncommented the lines regarding pdo slqite in the PHP.ini files

  • | 156 points

    php info() shows that i have sqlite pdo enabled but the command php -i only shows mysql pdo.

  • | 140 points

    Hola amigo pudo responder ese problema? que hizo al fin? me paso lo mismo.

  • | 12796 points

    @Silver343 if you have a different PHP version using the command line (type PHP -v to confirm), you probably need to update your environment variables:

    See laragon > docs > isolated

    Just click Menu > Tools > PATH environment variable > Add Laragon to Path

    You then need to Log off and back on for the path to be added to all terminals (CMD/ Shell / Terminal etc.)

    One point to note: if you change PHP version, you need to run Remove Laragon from Path, log off and back on. Then Add Laragon to Path log off and back on!

    The new PHP version will then be available in all terminals.

  • | 140 points

    I am working with a personal project which was sent to me, could you tell me why when I give to migrate my tables I get an error which says that "could not find drivers (SQL: PRAGMA foreign_keys = ON)".
    I tell you today I did my upgrade to php 8.0.3 and the project I do with laravel 8, from laragon in the same I get activated or selected extension=pdo_sqlite
    1_1619021232309_Image 29.png 0_1619021232305_Image 28.png

  • | 12796 points

    @Gabrielb2020 there are three known problems when switching to PHP8:

    1. mod_php.conf, change php8_module to php_module, see PHP 8.0 (8.0.0alpha1) testing anyone? (This affects Apache not Nginx)
    2. VS16 is required, see PHP 8.0 (8.0.0alpha1) testing anyone?
    3. PHP extensions are not automatically registering in php.ini, see Don't support PHP8?

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.