收藏
回答

云托管php驱不动mysql could not find driver?

dockerfile如下:

FROM php:8.2-fpm-alpine



RUN echo "http://mirrors.aliyun.com/alpine/v3.9/main/" > /etc/apk/repositories \
    && echo "http://mirrors.aliyun.com/alpine/v3.9/community/" >> /etc/apk/repositories



# 安装 PHP 扩展
#install pdo_mysql ext



# 安装 Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer


    
#install pdo_mysql ext
#RUN docker-php-ext-install pdo_mysql


#install nginx


RUN apk add --no-cache nginx



    
COPY ./server.conf /etc/nginx/conf.d/default.conf


WORKDIR /laravel


COPY . .


RUN chmod -R 777 /laravel/storage
RUN chmod -R 777 /laravel/bootstrap/cache


RUN mkdir -p /run/nginx




EXPOSE 80
ENV TZ Asia/Shanghai


CMD ["sh","-c","nginx && php-fpm"]

结果报错could not find driver?

新增mysql扩展

RUN docker-php-ext-install pdo_mysql


--------------------
  15 |
  16 |     #install pdo_mysql ext
  17 | >>> RUN docker-php-ext-install pdo_mysql
  18 |
  19 |     #install nginx
--------------------
ERROR: failed to solve: process "/bin/sh -c docker-php-ext-install pdo_mysql" did not complete successfully: exit code: 139


pdo mysql 无法安装


有没有现成的案例


回答关注问题邀请回答
收藏

1 个回答

  • ChJ
    ChJ
    2天前

    我也是这个could not find driver (SQL: select * from information_schema.tables where table_schema = sdsp and table_name = migrations)

    搞定了吧哈,能否share一下?

    2天前
    有用
    回复
登录 后发表内容
问题标签