嗨,我正在尝试将广告 PDO 连接到我的 mysql 服务器。 我一直收到这个错误:
Fatal error: Uncaught PDOException: could not find driver in /var/www/html/db-connectie.php:10 Stack trace: #0 /var/www/html/db-connectie.php(10): PDO->__construct('sqlsrv:Server=3...', 'root', Object(SensitiveParameterValue)) #1 /var/www/html/CalculatorController.php(2): include('/var/www/html/d...') #2 /var/www/html/zoekvolumecalculator.php(1): include('/var/www/html/C...') #3 {main} thrown in /var/www/html/db-connectie.php on line 10
我试图重新安装 php-mysql 但我得到这个错误:
root@add903f14c65:/var/www/html# apt install php-mysql
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package php-mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
这是我的docker文件:
FROM php:8.2-apache
RUN apt-get update
RUN apt-get install -y libpq-dev
RUN docker-php-ext-install pdo pdo_mysql
COPY ./ /var/www
COPY ./web /var/www/html
COPY ./config/site.conf /etc/apache2/sites-available/site.conf
COPY ./config/site.conf /etc/apache2/sites-available/site.conf
COPY php.ini /usr/local/etc/php
RUN a2enmod rewrite
EXPOSE 80
我认为这是一个非常简单的问题,但我找不到问题