Project logo

Docker web stack

Simple Apache2+php+mysql docker stack.


Web server stack

Information

PHP:

  • ver. 7.4
  • modules: pdo, pdo_mysqlm, mysqli, zip, (xdebug)

Apache

  • web root: www
  • IP address (external - host): localhost:9090
  • IP address (local - docker): 172.28.0.10

MariaDb:

  • host: db (port 3307)
  • local IP: 172.28.0.11 (port 3306)
  • root access: root/LocalData
  • user access: data/localdata

phpmyadmin:

  • IP address (external - host): localhost:9091

Installation

Go to directory xamp/docker_web

Linux

  • in bash, run: make dev

Windows

  • in command line, run file make_dev_win.bat

Detailed description

In xamp/docker_web directory is prepared Makefile with these actions:

  • dev - run XAMP stack: apache, mysql, phpmyadmin
  • stop - stop XAMP stack (stop docker instances)
  • xdebug-start - turn-on xdebug module (debugging tool)
  • xdeug-stop - turn-off xdebug module
  • import-db - import prepared SQL file into internal database
  • attach - run bash in docker_www container

Debugging using xdebug

With xdebug module is poosible debug php code running inside in docker. You need IDE with xdebug support PhpStorm

  • Open File/Settings
  • select Languages and Frameworks / PHP / Servers : add new server
  • Name: custom name e.g. "localDocker"
  • Host: IP addres of your PC
  • Port: 9090
  • Debbuger: XDebug
  • In the bottom list, in the right column 'Absolute path on the server' put value '/var/www/PROJECT', where in left column is selected path in part 'Project files'. Note, PROJECT mean name of directory www.


Makefile
Shell
php

Git