PHP 5.3 reached EOL on 14 Aug 2014 and thus, official docker support was dropped. Use only for legacy projects that's can run only PHP 5.3
DockerfileIf you don't want to include a Dockerfile in your project, it is sufficient to do the following:
docker run -it --rm --name my_blog -v "$PWD":/var/www/html nibrev/php-5.3-apache
This image contains Debian's Apache httpd in conjunction with PHP (as mod_php) and uses mpm_prefork by default.
DockerfileFROM nibrev/php-5.3-apache
COPY src/ /var/www/html/
Where src/ is the directory containing all your PHP code. Then, run the commands to build and run the Docker image:
$ docker build -t my-php-app .
$ docker run -d --name my-running-app my-php-app
We recommend that you add a php.ini configuration file; see the "Configuration" section for details.
Dockerfile$ docker run -d -p 80:80 --name my-apache-php-app -v "$PWD":/var/www/html nibrev/php-5.3-apache
DocumentRoot (or other Apache configuration)Some applications may wish to change the default DocumentRoot in Apache (away from /var/www/html). The following demonstrates one way to do so using an environment variable (which can then be modified at container runtime as well):
FROM nibrev/php-5.3-apache
ENV APACHE_DOCUMENT_ROOT /path/to/new/root
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
To install additional modules use a Dockerfile like this:
FROM nibrev/php-5.3-apache
# Installs curl
RUN docker-php-ext-install curl
Then build the image:
$ docker build -t my-php .
This image ships with the default php.ini-development and php.ini-production configuration files.
It is strongly recommended to use the production config for images used in production environments!
The default config can be customized by copying configuration files into the $PHP_INI_DIR/conf.d/ directory.
FROM nibrev/php-5.3-apache
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
The default Apache2 virtual host configuration file is /etc/apache2/sites-enabled/000-default.conf, you can replace it by overwriting via Dockerfile or direct mounting external file.
$ docker run -d -p 80:80 --name my-apache-php-app -v "$PWD/vhost.conf":/etc/apache2/sites-enabled/000-default.conf nibrev/php-5.3-apache
View license information for the software contained in this image.
Content type
Image
Digest
Size
288.2 MB
Last updated
almost 6 years ago
docker pull nibrev/php-5.3-apache