This container is designed to be used for local development. As such, it has not been hardened as required for a production environment.
This container implements an Apache + PHP 8.1 server. See the list of features below to
understand what this container offers over the stock php:<version>-apache
container.
The compiled versions of this container can be found in the container registry.
- Apache2 + PHP 8.1 server
- SSL Enabled
- Xdebug enabled with session cookie
- Apache access logs redirected to
STDOUT
- Composer pre-installed
- WP-CLI pre-installed
This image uses environment variables to allow the configuration of some parameters at run time:
- Description: Set the timezone inside the container.
- Default:
America/New_York
- Description: The path of the folder that's served up by Apache.
- Default:
/var/www/html
- Description: The DNS name or IP address of the computer where Xdebug events should be sent when debugging is enabled via the cookie or query string. See Xdebug's docs about how to enable debugging.
- Default:
host.docker.internal
. See the Docker documentation for information regarding this DNS name.
- Description: The port of the computer where Xdebug events should be sent when debugging is enabled via the cookie or query string. See Xdebug's docs about how to enable debugging.
- Default:
9003
. See the Docker documentation for information regarding this DNS name.
- Description: The hostname that Apache will assign to itself.
- Default:
local.dev
- If this is set incorrectly, Xdebug events will not make it to the Xdebug client that is listening for them.
- You most likely will need to open up TCP port
9003
on the Xdebug client computer as the Xdebug client computer's firewall will likely block this traffic.
- Description: Tell the container what type of terminal you're using for displaying the output from the container.
- Default:
xterm
- Description: The address and port for the memcached server.
- Default: Not set
- Example:
memcached:11211
There are no official volumes in this container. However, here are some recommended locations to attach volumes.
/var/www/html
- The path from which Apache serves up files./etc/pki/tls
- Used for SSL signing
80
inbound - Apache listens on this port.TCP 9003
outbound - IfXDEBUG_REMOTE_PORT
is defined to be something else, then that outbound port must be opened. Xdebug events are sent from the container to the address defined by theXDEBUG_REMOTE_HOST
environment variable. This does not need to be opened in the Docker firewall. However, this port may need to be opened on the inbound firewall of the computer that is receiving the Xdebug events.
If you are wanting to use SSL (port 443), the following certificate files must exist:
/etc/pki/tls/cert/cert.pem
- Corresponds to the ApacheSSLCertificateFile
file./etc/pki/tls/private/privkey.pem
- Corresponds to the ApacheSSLCertificateKeyFile
file.
- Start the container serving up files in a named volume.
docker run --rm -v /home/jdoe/project/html:/var/www/html -v /home/jdoe/.letsencrypt:/etc/pki/tls \
-t wildscamp/php
- Start the container serving up files in a named volume but sending Xdebug events to
172.25.64.1
.
docker run --rm -v /home/jdoe/project/html:/var/www/html -v /home/jdoe/.letsencrypt:/etc/pki/tls \
-e "XDEBUG_REMOTE_HOST=172.25.64.1" \
-t wildscamp/php
- Setting up in a docker-compose.yml. Full sample here.
services:
mysql:
# Mysql container definition
php:
image: wildscamp/php
environment:
- TIMEZONE=America/New_York
- XDEBUG_REMOTE_HOST=host.docker.internal
- WP_CACHE_MEMCACHED_ADDR=memcached:11211
ports:
- "80:80"
- "443:443"
working_dir: /var/www/html
volumes:
- ./html:/var/www/html
- ./certificates:/etc/pki/tls
links:
- mysql:db
restart: on-failure