A base PHP Docker image providing Apache, the Sury PHP repository as well as a simple installation script to install any PHP package provided by the Sury PHP repository.
The following example will Install PHP 8.2 with curl, gd and pdo_mysql as additional PHP extensions.
FROM ghcr.io/programie/php-docker
RUN install-php 8.2 curl gd pdo-mysqlBy default, the php.ini is located at /etc/php/${php_version}/apache2/php.ini for Apache and /etc/php/${php_version}/cli/php.ini for the CLI.
Additionally, a symlink pointing to the config directory of the currently installed PHP version is created at /etc/php/current. In that way, it is possible to add php.ini files independently of the PHP version.
To share the same configuration between Apache and CLI, there is also a shared global.ini located at /etc/php/current/global.ini. This file is symlinked as 50-global.ini into the conf.d folder of the Apache and CLI config directories (/etc/php/current/apache2/conf.d/50-global.ini and /etc/php/current/cli/conf.d/50-global.ini).
The default document root is /var/www/html but can be changed using the environment variable WEB_ROOT.
The default timezone is UTC but can be changed using the environment variable TZ.
By default, the Apache httpd webserver is started if no other command is specific on container startup.
To execute specific scripts before starting the webserver, put the scripts in the /docker-entrypoint.d directory.
This is useful to run application migrations before starting the webserver.