Sign inSign up

tomashavlas/php-httpd

By tomashavlas

•Updated over 7 years ago

PHP w/ Apache HTTPd server container image

Image
0

569

tomashavlas/php-httpd repository overview

⁠PHP 7.2 w/ Apache HTTPd server server container image

This container image includes PHP version 7.2 with Apache HTTPd server version 2.4 based on Debian.

The container image is available on Docker Hub⁠ as tomashavlas/php-httpd:7.2-debian9.

⁠Description

PHP⁠ is a popular general-purpose scripting language that is especially suited to web development.

This container image provides containerized packaging of PHP 7.2 with Apache HTTPd 2.4. This image can be used as a base image for other applications based on PHP 7.2, image can be extended using source-to-image⁠ tool.

⁠Usage

This image can be used as a base image for other applications based on PHP.

This will create container named php-httpd running PHP with Apache HTTPd, serving data from /wwwdata directory. Port 8080 will be exposed and mapped to the host.

$ docker run -d --name php-httpd -p 8080:8080 -v /wwwdata:/srv/www:Z tomashavlas/php-httpd:7.2-debian9

This will create new Docker layered image named php-httpd-app, using source-to-image, while using data available in /wwwdata on the host.

$ s2i build file:///wwwdata tomashavlas/php-httpd:7.2-debian9 php-httpd-app

To run new image, simply execute:

$ docker run -d --name php-httpd -p 8080:8080 php-httpd-app

⁠S2I source repository layout

This image can be extended using source-to-image tool (see Usage section).

Application source code should be located in the root of the source directory.

./.php-httpd/conf.d

Should contain additional PHP configuration files (*.conf), those will be copied into /etc/php/conf.d.

./.php-httpd/pre-init.d

Should contain custom container initialization scripts, those will be copied into /usr/share/container-entrypoint/php-httpd/pre-init.d.

NOTE: This image extends S2I source repository layout of Apache HTTPd 2.4⁠ container image.

⁠Environment variables

This images recognizes the following environment variables that can be set during initialization by passing -e VAR=VALUE to the Docker run command.

PHP_MODULES

List of PHP modules that should be enabled (separated by comma).

NOTE: This image includes support for environment variables defined by Apache HTTPd 2.4⁠ container image.

⁠Volumes

The following mount points can be set by passing -v /host/path:/container/path to the Docker run command.

/srv/www

PHP application source directory.

NOTE: This image includes support for volumes defined by Apache HTTPd 2.4⁠ container image.

⁠Troubleshooting

The PHP in the container logs to the standard output by default, so the logs are available in container log. The log can be examined by running:

$ docker logs <container>

⁠See also

Dockerfile and other sources for this container image are available on https://github.com/tomashavlas/container-php-httpd⁠.

Tag summary

Content type

Image

Digest

Size

186.5 MB

Last updated

over 7 years ago

docker pull tomashavlas/php-httpd:7.2-debian9