Skip to content

PHP Development with multiple PHP versions

Notifications You must be signed in to change notification settings

frantastic9911/php-unicorn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PHP Development with multiple PHP versions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 69.5%
  • PHP 17.0%
  • Python 8.4%
  • HTML 5.1%