Git Product home page Git Product logo

php-unicorn's Introduction

PHP Development Environment

Multiple PHP versions (with PHP-FPM) + Webserver + Database

Run PHP versions (5.3, 5.4, 5.5) with PHP-FPM as docker containers and easily switch PHP versions within your webserver.

Apache Example

<VirtualHost *>
  VirtualDocumentRoot /www/%0
  Use PHP-5.4 /www/%{SERVER_NAME}
</VirtualHost>

nginx @todo

Docker Container Overview

                                +---------- /www data ------------+
                                |                                 |
                              mount                             mount    
                                |                                 |
                                v                                 v
DB (i.e. MySQL 3306) <-link-> PHP 5.3 (PHP-FPM 20053) <-link-> Webserver (i.e. Apache 80)
                              PHP 5.4 (PHP-FPM 20054)
                              PHP 5.5 (PHP-FPM 20055) 

PHP containers are linked to DB containers, so PHP is able to do mysql_connect('127.0.0.1', ..). Behind the scenes there is some magic (rinetd) which maps all requests to 127.0.0.1:3306 to the actual IP of the DB container. 127.0.0.1:21 is mapped to the actual FTP container. Of course, the Webserver is linked to the PHP containers as well.

Your www data directory is mounted to both, the PHP containers and the Webserver container, under /www.

Setup

Mac OS X with Boot2docker

Prerequisites: VirtualBox, boot2docker, boot2docker.iso with VirtualBox Guest Additions, fig

git clone https://github.com/mattes/php-unicorn
cd php-unicorn
boot2docker up
./build-fig.sh ./www
fig up # see fig.yml
open http://<boot2docker-ip>:8080
Service Host Exposed Docker Container
Apache 8080 80
MySQL 3306 3306
FTP 2121 2121
PHP 5.3 - 20053
PHP 5.4 - 20054
PHP 5.5 - 20055

By default "dangerftp" is started. Type any path under wwww as username, to make this the entry path for the FTP session. Field password is ignored.

Linux

Prerequisites: Docker, fig

# see above

Build Custom Docker Containers

You can build your own docker containers. Check the ./dockerfile.sh helper.

Next steps

Further Readings

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.