Sign inSign up

mahype/phpbrew

By mahype

•Updated about 9 years ago

PHPBrew container

Image
0

335

mahype/phpbrew repository overview

⁠PHPBrew for docker

This image contains the preinstalled latest PHP minor versions 7.1.8, 7.0.22 and 5.6.31. Other versions will be downloaded on composing.

⁠Setting up nginx with docker-compose

Example for a docker-compose.yml with the phpbrew container.

version: '3.1'
services:
  web:
    image: nginx:latest
    ports:
        - "80:80"
    volumes:
        - ./code:/code
        - ./site.conf:/etc/nginx/conf.d/default.conf
  php:
    image: mahype/phpbrew
    ports:
        - "9000:9000"
    environment:
        PHP_VERSION: "7.0.22"
    volumes:
        - ./code:/code
⁠Configure nginx

Set the fastcgi_pass containername:9000 to your container name you are using in your compose file.

server {
    index index.php index.html;
    server_name localhost;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /code;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass containername:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}
⁠Adding other PHP versions via Dockerfile

You cann add and use your own version by adding a Dockerfile with the content like this. Just change to the version you want to use:

FROM mahype/phpbrew:latest

ENV ACTIVE_PHP_VERSION=7.0.0
RUN phpbrew install php-${ACTIVE_PHP_VERSION} ${ACTIVE_PHP_VARIANTS}
CMD start

Tag summary

Content type

Image

Digest

Size

485.8 MB

Last updated

about 9 years ago

docker pull mahype/phpbrew