Docker Community Forums

Share and learn in the Docker community.

Execute mysqli commands from php nginx


(Vin67) #1

Hi I’m new to Docker & Compose. I’ve created a Docker.yml file with nginx, fpm & mysql. I can execute php commands but I can’t execute mysqli commands. phpinfo.php shows '–enable-mysqlnd’ and it appears to be installed. Configuration File (php.ini) Path /usr/local/etc/php is doesn’t have any php.ini… i’m not sure what to do to get this mysql commands to work. Appreciate some help!

version: ‘2’

services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
networks:
- code-network
links:
- php

php:
    image: php:fpm
    volumes:
        - ./code:/code
    networks:
        - code-network
    links:
        - db
db:
  image: mysql:5.7
  ports:
    - "3306:3306"
  volumes:
    - /var/lib/mysql
    - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
  environment:
    - MYSQL_ROOT_PASSWORD=mypassword
    - MYSQL_DATABASE=lbb
  networks:
    - code-network

networks:
code-network:
driver: bridge