Try adding it here and rebuild
docker-php-ext-install bcmath pdo pdo_mysql mysqli calendar gd zip sqlite3;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a laravel project I'm trying to build with docker compose. Here's my compose file:
# Set up php ini and project .env
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini;
cp .env.example .env;
echo DB_CONNECTION=mysql >> .env;
sed -i.bak "s/^DB_HOST.*/DB_HOST=database/" .env;
# Install nvm and node v10.14.2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash;
export NVM_DIR="$HOME/.nvm";
test -s "$NVM_DIR/nvm.sh" && \. "$NVM_DIR/nvm.sh"; # This loads nvm
test -s "$NVM_DIR/bash_completion" && \. "$NVM_DIR/bash_completion"; # This loads nvm bash_completion
nvm install 10.14.2;
# Install libraries and extensions needed for php
apt-get update;
yes | apt-get install git curl unzip libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmcrypt-dev libreadline-dev libzip-dev libnotify-bin default-mysql-client; #mariadb-client;
yes | pecl install mcrypt-1.0.5;
docker-php-ext-install bcmath pdo pdo_mysql mysqli calendar gd zip;
# Install composer and composer dependencies
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer;
composer install;
# MySQL config stuff
echo [client-server] >> /etc/mysql/my.cnf;
echo host = database >> /etc/mysql/my.cnf;
mysqladmin -uroot create 'homestead';
touch create-homestead.sql;
echo "CREATE USER 'homestead'@'%' IDENTIFIED BY 'secret';" >> create-homestead.sql;
mysql -uroot homestead < create-homestead.sql;
# Run phpunit tests
./vendor/bin/phpunit -c phpunit.xml;
#npm install;
#npm run build;
When I run the phpunit tests, I get this error:
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
Note the "could not find driver" error message. I looked that up in the laravel source code and found the following code:
try {
$this->manualDb = new \PDO('sqlite:'.$dbFile);
} catch (\PDOException $e) {
if ($e->getMessage() === 'could not find driver') {
throw new RuntimeException('SQLite PDO driver not found', 0, $e);
} else {
throw $e;
}
}
The line $this->manualDb = new \PDO('sqlite:'.$dbFile); Makes me think it's the sqlite driver it's missing. But when I run the command php -m I get this:
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
I see pdo_sqlite and sqlite3. Seems like they're enabled and everything. Does anyone know how to fix this?
Please or to participate in this conversation.