Level 73
Check this guide out it might help you solve your issues
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to get mySQL working in Laravel using Docker. The website comes up but anything to do with database connection doesn't. I have installed mySQLi so I am not sure. Here is my Docker configuration
version: '3.1'
services:
dockertemplate:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./../public:/public
- ./default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
links:
- php
php:
#image: php:7.2-fpm
build: ../
ports:
- 9000
volumes:
- ./../public:/public
mariadb:
image: mariadb:10.4
restart: always
environment:
MYSQL_DATABASE: 'mydb'
MYSQL_ROOT_PASSWORD: '123'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
ports:
- "3306:3306"
volumes:
- ./db/:/var/lib/mysql
# Run adminer if we want to see db
# Connection server is "mariadb"
adminer:
image: adminer
restart: always
ports:
- 8081:8080
Here is my Dockerfile configuration
FROM php:7.2-fpm
RUN docker-php-ext-install mysqli
WORKDIR /public
COPY public/* /public/
EXPOSE 9000
I am not sure what I am missing.
I am getting the following error
"could not find driver (SQL: select * from users)"
Please or to participate in this conversation.