<?php
define('DB_NAME', 'Database name');
define('USER_NAME', 'username');
define('USER_PASS', 'password');
try {
$pdo = new PDO(
DB_NAME,
USER_NAME,
USER_PASS,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
PDO::ATTR_EMULATE_PREPARES => false
]
);
} catch (PDOException $e) {
echo $e->getMessage();
exit;
}
could not find driver
php -m | grep pdo
# pdo_sqlite
FROM php:7.2-fpm
COPY php.ini /usr/local/etc/php/
#add to
RUN docker-php-ext-install pdo_mysql
Reference [Laravel] could not find driver in LAMP environment of CentOS