首页 > 解决方案 > 用 sqlite 连接 symfony

问题描述

错误: 错误

我的问题可能看起来很傻,但我不知道该怎么做。

我创建了一个 symfony 项目并想将它连接到 sqlite 数据库。

这是我的学说配置

我还设置了 DATABASE_URL 变量。

但是,例如,当我想生成迁移时,我得到错误找不到驱动程序。

我精确地通过下载一个 zip 文件安装了 sqlite。

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_sqlite'
        server_version: '5.7'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci

        url: '%env(resolve:DATABASE_URL)%'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App

如果有人知道该怎么做,我将非常感激:)

标签: sqlitesymfony

解决方案


要么你的驱动没有正确安装,运行 php -m 看看它是否出现在列表中或者你需要重启你的网络服务器(即使它是嵌入式的 php-symfony 网络服务器)


推荐阅读