Database connection error problem
BehroozBvk opened this issue · comments
Hello, I installed the framework using Docker, but when running the http://localhost:8000
, I get an error connecting to the database, please help me.
Error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined function mysql_connect()
docker-compose.yml
version: "3.4"
services:
themosis:
build:
context: ../
dockerfile: docker/development.Dockerfile
image: themosis
container_name: themosis
hostname: themosis
restart: unless-stopped
working_dir: /var/www/html
tty: true
ports:
- "8000:80"
depends_on:
- mysqldb-themosis
volumes:
- ../:/var/www/html
networks:
- devnet
mysqldb-themosis:
image: mysql:8.0
container_name: mysqldb-themosis
hostname: mysqldb-themosis
command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
- DATABASE_ROOT_PASSWORD=123456
- DATABASE_PASSWORD=123456
- DATABASE_NAME=themosisdb
- DATABASE_USER=mysqldbdbuser
volumes:
- /home/$USER/volumes/mysqldbvolume-themosis:/var/lib/mysql
ports:
- "33019:3306"
restart: always
networks:
- devnet
myadmin-themosis:
image: phpmyadmin/phpmyadmin
container_name: myadmin-themosis
hostname: myadmin-themosis
depends_on:
- mysqldb-themosis
environment:
- PMA_HOST=mysqldb-themosis
restart: always
ports:
- "33020:80"
networks:
- devnet
networks:
devnet:
external: true
.env
DATABASE_NAME=themosisdb
DATABASE_USER=mysqldbdbuser
DATABASE_PASSWORD=123456
DATABASE_HOST=mysqldb-themosis
DATABASE_PORT=33019
Does anyone have any suggestions for a solution?
Hello @BehroozBvk. I generally don't provide any support here. But perhaps in your case your docker image is missing php extensions like mysqli
when you build it within your Dockerfile file. You might get more help by posting your question on ServerFault in this case.
Hello @BehroozBvk. I generally don't provide any support here. But perhaps in your case your docker image is missing php extensions like
mysqli
when you build it within your Dockerfile file. You might get more help by posting your question on ServerFault in this case.
Thank you for your reply. You were right, I should have installed extension php7-mysqli on Dockerfile. Solved problem.