Coder Social home page Coder Social logo

phoenixrvd / docker-php-environment Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 19 KB

Eine Sammlung von Docker-Containern mit unterschiedlichen PHP-Versionen, gleichen INI-Einstellungen und PHP-Extensions.

PHP 7.45% Shell 92.55%
php56 php70 php71 php72 mysql pgsql apache2 php docker docker-compose mit

docker-php-environment's Introduction

PHP - Development environment

Eine Sammlung von Docker-Containern mit unterschiedlichen PHP-Versionen, gleichen INI-Einstellungen und PHP-Extensions.

Anleitung

Start

Einfach in Projekt-Verzeichnis ablegen und folgendes in Console ausführen.

docker-compose up

APP-Domäne

Damit die Webapp auf eine echte Domäne läuft, sollte man jeweilige Container-IP (Apache2-Module) in statische DNS-Tabelle auf eigenem Rechner eintragen.

Purpose

Fast immer muss ein PHP-Entwickler seine Anwendung unter unterschiedlichen PHP-Version laufen lassen und testen.

Das Aufsetzen von eine PHP-Umgebung kann teilweise Stunden in Anspruch nehmen. Die Sammlung startet gleichzeitig mehrere unterschiedliche PHP-Versionen und mappt sie automatisch auf lokale ports, sodass man ganz ohne Aufwand zwischen unterschiedlichen PHP-Versionen wechseln kann.

Funktionsweise

Die Automatisierung ist mit Docker Compose realisiert und bleibt somit nach Möglichkeit eine Standard-Lösung.

PHP

Alle PHP-Versionen sind offizielle PHP-Docker-Container.

Hosts und Versionen

Folgende Versionen sind als Apache2-Module installiert.

PHP URL IP
5.6.33 localhost:8056 10.100.110.56
7.0.27 localhost:8070 10.100.110.70
7.1.14 localhost:8071 10.100.110.71
7.2.2 localhost:8072 10.100.110.72

Extensions

Liste aller installierten PHP-Extensions

  • xdebug
  • mcrypt
  • gd
  • curl
  • iconv
  • json
  • libxml
  • mbstring
  • mysqlnd
  • sqlite3
  • pgsql
  • mysql
  • zip
  • libxml
  • soap
  • mysqli
  • IonCube

Debugging und Profiling

Beim Starten eines Containers wird automatisch 'tmp' - Verzeichnis im Projekt-Root angelegt. Das Verzeichnis muss unbedingt beschreibbar gemacht werden, weil PHP da die cachegrid.* und trace.* Dateien mit www-data speichert.

Xdebug ist im Standard bereits aktiviert und kann in 'Auto-Mode' ohne besondere IDE- und Server-Einstellungen genutzt werden. Gute Artikel dazu findet man [hier]

Datenbanken

Datenbank-Server werden bereits mit eine datenbank installiert. Innerhalb von PHP-Container sind die Host-Namen bekannt. D.h. in eigene Applikation kann man als Host beispielsweise einfach 'mysql' verwenden.

Sollte man die Datenbank von IDE aus verwenden, so muss man die IP statt hostname nutzen.

Es werden keine Dumps automatisch eingespielt, die Datenbanken werden Leer erzeugt. Wenn man bereits eine SQL-Datei mit daten zur verfügung hat kann man sie Manuell Einspielen

Hosts und Versionen

Version IP Host Port User Password Database
MariaDB 10.2 (Like Mysql5.7) 10.100.110.241 mysql57 3306 webapp webapp webapp

Dump

Die Sicherung-SQL werden im Standard unter ./tmp - Verzeichnis im Root - Verzeichnis des Projektes abgelegt.

Dei Einstellung kann man anpassen in dem man DATABESES_BACKUP_PATH in Environment setzt. (.env-Datei)

docker exec phpenv_mysql57_1 dump

Restore

Die gesicherte Datenbanken kann man auch wiederherstellen.

docker exec phpenv_mysql57_1 restore demps/backup.sql
  1. Den Pfad muss relative zu Projekt-Root sein.
  2. Die Sym-Links werden nicht funktionieren.

Login ins Container

docker exec -it <container_name> /bin/bash

Example: 'docker exec -it phpenv_php56_1 /bin/bash'

Contributing

Aktualisieren von Inhaltsverzeichnis

doctoc README.md --notitle

Copyright and license

Code released under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.