gpt4 book ai didi

php - 在lumen 5.6应用中找不到驱动程序错误(在docker + alpine linux + nginx + php-fpm 7.2中运行)

转载 作者:行者123 更新时间:2023-12-02 20:01:13 28 4
gpt4 key购买 nike

我试图将数据库访问权限添加到我的Lumen 5.6应用程序中,该应用程序当前在以下LEMP Stack中的docker中运行:

  • Alpine Linux
  • PHP-FPM 7.2.x
  • NGINX

  • 我的撰写文件如下所示:
    version: '2.1'

    services:

    webhooks-mysql:
    container_name: webhooks-mysql
    image: mysql:5.7
    restart: always
    environment:
    MYSQL_ROOT_PASSWORD: 123456
    MYSQL_DATABASE: webhooks
    MYSQL_USER: webhooks
    MYSQL_PASSWORD: 123456
    healthcheck:
    test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
    timeout: 20s
    retries: 10
    ports:
    - "33401:3306"

    webhooks-service:
    container_name: webhooks-service
    depends_on:
    webhooks-mysql:
    condition: service_healthy
    build: .
    mem_limit: 64M
    ports:
    - "9050:80"
    volumes:
    - ./:/app:cached

    并且我的 .env中包含以下内容:
    APP_NAME=webhooks
    APP_ENV=local
    APP_DEBUG=true
    APP_KEY=base64:123456=
    APP_TIMEZONE=UTC

    DB_CONNECTION=mysql
    DB_HOST=webhooks-mysql
    DB_DATABASE=webhooks
    DB_USERNAME=webhooks
    DB_PASSWORD=123456

    最后;我的容器具有所有require依赖项:
    php7 php7-fpm php7-mysqli php7-pdo php7-openssl php7-mbstring
    php7-xml php7-tokenizer php7-json php7-openssl php7-curl php7-zlib
    php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-ctype
    php7-mbstring php7-gd php7-zip git nginx supervisor curl zip unzip

    以及以下 Composer 软件包:
      "require": {
    "php": ">=7.1.3",
    "laravel/lumen-framework": "5.6.*",
    "vlucas/phpdotenv": "~2.2",
    "wikimedia/ip-set": "^1.2",
    "doctrine/dbal": "^2.8"
    }

    当我尝试在容器中运行迁移时,出现以下错误:

    /app # php artisan migrate

    In Connection.php line 664: could not find driver (SQL: select * from information_schema.tables where table_schema = webhooks and table_name = )

    In PDOConnection.php line 50: could not find driver



    任何想法为什么我会收到此错误?

    我已经验证了php-mysql / pdo扩展已加载,env值正确,等等...我似乎无法弄清楚。

    最佳答案

    由于docker镜像已被完全剥离,因此您可能会遇到更多依赖关系,我遇到了相同的问题并通过添加扩展名pdo_mysql以及现有扩展名(pdomysqlimbstring)进行了修复。

    关于php - 在lumen 5.6应用中找不到驱动程序错误(在docker + alpine linux + nginx + php-fpm 7.2中运行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53526168/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com