Reputation: 3993
When creating a LEMP stack using PHP-FPM I can't seem to load the PDO dirver it keeps defaulting to the sqlite driver.
Docker compose:
version: "3.5"
services:
redis:
image: redis:alpine
container_name: errors-redis
mysql:
image: mysql:8.0
container_name: errors-mysql
working_dir: /application
volumes:
- .:/application
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_DATABASE=errors
- MYSQL_USER=test
- MYSQL_PASSWORD=test
ports:
- "9011:3306"
webserver:
image: nginx:latest
container_name: errors-nginx
working_dir: /application
volumes:
- .:/application
- ./dev/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "9010:80"
php-fpm:
image: php:fpm
container_name: errors-php-fpm
working_dir: /application
volumes:
- .:/application
- ./dev/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini
Docker file:
FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install php-memcached php7.2-mysql php-redis php-xdebug \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
PHP ini
upload_max_filesize = 100M
post_max_size = 108M
Now when I check phpinfo()
PDO support enabled
PDO drivers sqlite
I've not installed sqlite at any point so I'm not sure how it's gotten it. How do I change it to use MySQL instead of sqlite?
Upvotes: 0
Views: 1797
Reputation: 57121
You need to add the PDO bits to your install as well...
apt-get -y --no-install-recommends install php-memcached php-redis php-xdebug mysqli pdo pdo_mysql \
Specifically the last 3. You can probably miss out the php7.2-mysql as this should be covered with the mysqli option.
Upvotes: 2