|
1 | | -# Highly configurable PHP and Apache images |
| 1 | +# Highly Configurable PHP and Apache Images |
2 | 2 |
|
3 | | -These are Apache Docker images with PHP. See the corresponding subdirectory for specific Dockerfiles and documentation. |
| 3 | +[](https://github.com/panubo/docker-php-apache/actions/workflows/multi-build-push.yml) |
4 | 4 |
|
5 | | -NB. Images may not be feature identical depending on the base OS used and the level of development of the image. |
| 5 | +These are configurable Docker images for running PHP applications with Apache. They are designed to be easy to use, with a focus on consistent configuration across the images. |
6 | 6 |
|
7 | | -These images are available from the [Docker Hub](https://hub.docker.com/r/panubo/php-apache/). |
| 7 | +These images are available from: |
8 | 8 |
|
9 | | -## Production Images |
| 9 | +- [Quay.io](https://quay.io/repository/panubo/php-apache) |
| 10 | +- [AWS ECR Public Gallery](https://gallery.ecr.aws/panubo/php-apache) |
10 | 11 |
|
11 | | -- [Debian 13 (Trixie) Base](/debian13) - Recommended for PHP applications that require PHP 8.4 |
12 | | -- [Debian 12 (Bookworm) Base](/debian12) - Recommended for PHP applications that require PHP 8.2 |
| 12 | +## Features |
13 | 13 |
|
14 | | -## Legacy |
| 14 | +- **Multiple PHP Versions:** Support for a wide range of PHP versions, from modern PHP 8.x to legacy PHP 5.4. |
| 15 | +- **Apache 2.4:** Comes with Apache 2.4 pre-configured to work with PHP-FPM. |
| 16 | +- **Process Management:** Uses `s6` for process supervision, ensuring that both Apache and PHP-FPM are always running. |
| 17 | +- **Configuration Templating:** Uses `gomplate` to allow for dynamic configuration of Apache, PHP, and other services using environment variables. |
| 18 | +- **Common PHP Extensions:** Includes a wide range of commonly used PHP extensions, such as `mysql`, `pgsql`, `mongodb`, `redis`, `gd`, `imagick`, and more. |
| 19 | +- **Email Delivery:** Includes `msmtp` for sending emails from PHP applications to an SMTP server. |
| 20 | +- **X-Sendfile Support:** `mod_xsendfile` is enabled for efficient file serving. |
15 | 21 |
|
16 | | -- [Debian 11 (Bullseye) Base](/debian11) - Recommended for PHP applications that require PHP 7.4 |
17 | | -- [Debian 10 (Buster) Base](/debian10) - For legacy PHP applications that require PHP 7.3 |
18 | | -- [Debian 9 (Stretch) Base](/debian9) - For legacy PHP applications that require PHP 7.0 |
19 | | -- [CentOS 7 Base](/centos7) - For legacy PHP applications that require PHP 5.4 |
| 22 | +## Supported Images |
20 | 23 |
|
21 | | -# Status |
| 24 | +### Production Images |
22 | 25 |
|
23 | | -Stable. |
| 26 | +- **[Debian 13 (Trixie) Base](/debian13)** - Recommended for PHP applications that require PHP 8.4. |
| 27 | +- **[Debian 12 (Bookworm) Base](/debian12)** - Recommended for PHP applications that require PHP 8.2. |
| 28 | +- **[Debian 11 (Bullseye) Base](/debian11)** - For applications that require PHP 7.4. |
| 29 | + |
| 30 | +### Legacy Images |
| 31 | + |
| 32 | +- **[Debian 10 (Buster) Base](/debian10)** - For legacy PHP applications that require PHP 7.3. |
| 33 | +- **[Debian 9 (Stretch) Base](/debian9)** - For legacy PHP applications that require PHP 7.0. |
| 34 | +- **[CentOS 7 Base](/centos7)** - For legacy PHP applications that require PHP 5.4. |
| 35 | + |
| 36 | +_NB. Images may not be feature identical depending on the base OS used and the level of development of the image._ |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +Here is a simple example of how to use the image with `docker-compose`: |
| 41 | + |
| 42 | +```yaml |
| 43 | +services: |
| 44 | + web: |
| 45 | + image: panubo/php-apache:debian13 |
| 46 | + ports: |
| 47 | + - "8080:8000" |
| 48 | + volumes: |
| 49 | + - ./html:/html |
| 50 | + environment: |
| 51 | + # Example of using configuration |
| 52 | + httpd_root: /html/public |
| 53 | +``` |
| 54 | +
|
| 55 | +Place your PHP application code in the `html` directory. The web server will be available on `http://localhost:8080`. |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +### Environment Variables |
| 60 | + |
| 61 | +The images can be configured using environment variables. These variables are processed by `gomplate` to generate configuration files. |
| 62 | + |
| 63 | +For example, to change the document root, you can set the `httpd_root` environment variable. |
| 64 | + |
| 65 | +For a full list of available variables and templates, please check the `etc` directory within each image's subdirectory. |
| 66 | + |
| 67 | +### PHP Extensions |
| 68 | + |
| 69 | +A wide range of PHP extensions are included by default. You can see the full list in the `Dockerfile` for each image. |
| 70 | + |
| 71 | +### Apache Configuration |
| 72 | + |
| 73 | +The Apache configuration can be extended by mounting your own `.conf` files into `/etc/apache2/conf-enabled/` (for Debian-based images) or `/etc/httpd/conf.d/` (for CentOS-based images). |
| 74 | + |
| 75 | +## Contributing |
| 76 | + |
| 77 | +Contributions are welcome! Please feel free to submit a pull request or open an issue. |
| 78 | + |
| 79 | +## License |
| 80 | + |
| 81 | +This project is licensed under the [MIT License](LICENSE). |
| 82 | + |
| 83 | +## Status |
| 84 | + |
| 85 | +Stable and used in production. |
0 commit comments