├── .gitignore ├── etc ├── mysql │ ├── shop.sql │ ├── your_sql.sql │ └── magentoshop.sql ├── apache2 │ ├── httpd.conf │ └── hosts.conf ├── php │ └── php.ini └── docker │ └── dockerfile_php_7 ├── docker-compose.yml ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | sites/* 2 | npm-debug.log -------------------------------------------------------------------------------- /etc/mysql/shop.sql: -------------------------------------------------------------------------------- 1 | create database shop; -------------------------------------------------------------------------------- /etc/mysql/your_sql.sql: -------------------------------------------------------------------------------- 1 | create database wesleyd85; -------------------------------------------------------------------------------- /etc/mysql/magentoshop.sql: -------------------------------------------------------------------------------- 1 | create database magentoshop; -------------------------------------------------------------------------------- /etc/apache2/httpd.conf: -------------------------------------------------------------------------------- 1 | ServerName localhost 2 | RewriteEngine on 3 | RewriteCond %{HTTP:Authorization} ^(.*) 4 | RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] 5 | 6 | -------------------------------------------------------------------------------- /etc/apache2/hosts.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerAdmin webmaster@shop.com 3 | DocumentRoot "/var/www/html/shop.com/www" 4 | ServerName shop.com 5 | ServerAlias shop.com 6 | 7 | 8 | 9 | ServerAdmin webmaster@magentoshop.com 10 | DocumentRoot "/var/www/html/magentoshop.com/www" 11 | ServerName magentoshop.com 12 | ServerAlias magentoshop.com 13 | 14 | 15 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | php7: 2 | build: . 3 | dockerfile: ./etc/docker/dockerfile_php_7 4 | volumes: 5 | - ./sites:/var/www/html 6 | - ./etc/php:/usr/local/etc/php 7 | - ./etc/apache2/apache2.conf:/etc/apache2/conf-enabled/apache2.conf 8 | - ./etc/apache2/hosts.conf:/etc/apache2/sites-enabled/hosts.conf 9 | ports: 10 | - "80:80" 11 | - "8080:8080" 12 | links: 13 | - mysql 14 | 15 | 16 | mysql: 17 | image: mysql 18 | ports: 19 | - "3306:3306" 20 | environment: 21 | - MYSQL_ROOT_PASSWORD=MY_PASSWORD 22 | - MYSQL_DATABASE=YOUR_DATABASE_NAME 23 | volumes: 24 | - ./etc/mysql:/docker-entrypoint-initdb.d 25 | -------------------------------------------------------------------------------- /etc/php/php.ini: -------------------------------------------------------------------------------- 1 | display_errors = Off 2 | log_errors = On 3 | extension = mysqli.so 4 | extension = pdo.so 5 | extension = pdo_mysql.so 6 | 7 | memory_limit = 64M 8 | 9 | max_execution_time = 18000 10 | 11 | ; disable automatic session start 12 | ; before autoload was initialized 13 | 14 | flag session.auto_start = off 15 | 16 | ; enable resulting html compression 17 | 18 | zlib.output_compression = on 19 | 20 | ; disable user agent verification to not break multiple image upload 21 | 22 | suhosin.session.cryptua = off 23 | 24 | ; PHP for some reason ignores this setting in system php.ini 25 | ; and disables mcrypt if this line is missing in local php.ini 26 | 27 | extension=mcrypt.so 28 | 29 | extension=xsl.so 30 | extension=intl.so 31 | extension=zip.so 32 | 33 | extension=gd.so 34 | 35 | upload_max_filesize = 10M 36 | post_max_size = 10M 37 | 38 | 39 | -------------------------------------------------------------------------------- /etc/docker/dockerfile_php_7: -------------------------------------------------------------------------------- 1 | FROM php:7.0.16-apache 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y \ 5 | zlib1g-dev 6 | 7 | RUN apt-get install -y \ 8 | libxml2-dev 9 | 10 | RUN /usr/local/bin/docker-php-ext-install mysqli pdo pdo_mysql zip xmlwriter 11 | RUN apt-get install libssl-dev -y 12 | 13 | 14 | 15 | RUN /usr/local/bin/docker-php-ext-install zip 16 | 17 | 18 | # Install mcrypt 19 | RUN apt-get install -y libmcrypt-dev 20 | RUN docker-php-ext-install mcrypt 21 | 22 | # Install GD 23 | RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev 24 | RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 25 | RUN docker-php-ext-install gd 26 | 27 | # Install XSL 28 | RUN apt-get install -y libxslt-dev 29 | RUN docker-php-ext-install xsl 30 | 31 | # Install intl 32 | RUN apt-get install -y libicu-dev 33 | RUN pecl install intl 34 | RUN docker-php-ext-install intl 35 | 36 | RUN a2enmod rewrite 37 | RUN usermod -u 1000 www-data 38 | RUN usermod -G staff www-data -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 wesleyd85 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP 7, Apache, MySQL (LAMP) docker environment 2 | Docker container with php 7 on Apache (httpd) MySQL. Based on an docker-compose.yml file 3 | 4 | 5 | # Requirements 6 | - Docker 7 | - Virtualbox (mostly comes / gets installed with docker) 8 | - GIT 9 | - Little bit of git knowledge (to clone) 10 | 11 | This configution is made on `OSX` but should be working in every other operating system 12 | 13 | Note this document is based on the standard first up of docker (192.168.99.100) if this is different for your current situation please replace all IP addresses in your setup too. 14 | 15 | Go to your terminal and Clone or fork the project. 16 | 17 | 18 | - browse into `cd docker-php7-httpd-apache2-mysql` 19 | - open a DOCKER terminal 20 | - `sudo vi /etc/hosts` 21 | - add or replace IP with your docker IP: `192.168.99.100 host1.local` 22 | - Type in the docker terminal: `docker-compose build` 23 | - Type in the docker terminal: `docker-compose up -d` 24 | 25 | Now open your browser and go to: `http://host1.local/` 26 | in your browser you should see a PHP 7 info page. 27 | 28 | 29 | 30 | You can add more `Virtual Hosts` in `etc/apache2/hosts.conf` the host1.local is in there. 31 | 32 | When you want to change the database name and password take a look into `docker-compose.yml` 33 | 34 | # Multiple databases 35 | So far docker has no support for creating the databases with the .yml file. In this repo I created a folder called mysql which you can find in `etc/mysql` when you place your sql files in here, these will automatically be loaded when you start your docker --------------------------------------------------------------------------------