For more information about this image and its history, please see the [relevant manifest file (`library/php`)](https://github.com/docker-library/official-images/blob/master/library/php) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images).
Then, run the commands to build and run the Docker image:
docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
## With Apache
More commonly, you will probably want to run PHP in conjunction with Apache httpd. Conveniently, there's a version of the PHP container that's packaged with the Apache web server.
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 -it --rm --name my-running-app my-php-app
We recommend that you add a custom `php.ini` configuration. `COPY` it into `/usr/local/etc/php` by adding one more line to the Dockerfile above and running the same commands to build and run:
We provide two convenient scripts named `docker-php-ext-configure` and `docker-php-ext-install -j$(nproc)`, you can use them to easily install PHP extension.
For example, if you want to have a PHP-FPM image with `iconv`, `mcrypt` and `gd` extensions, you can inheriting the base image that you like, and write your own `Dockerfile` like this:
Remember, you must install dependencies for your extensions manually. If an extension needs custom `configure` arguments, you can use the `docker-php-ext-configure` script like this example.
# License
View [license information](http://php.net/license/) for the software contained in this image.
# Supported Docker versions
This image is officially supported on Docker version 1.7.0.
Support for older versions (down to 1.0) is provided on a best-effort basis.