diff --git a/README.md b/README.md index f77d1b47..6ab1f8e0 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,18 @@ If the `MAUTIC_DB_NAME` specified does not already exist on the given MySQL serv ### Enable / Disable Features - `-e MAUTIC_TESTER=...` (defaults to empty) Enables Mautic Github Pull Tester [documentation](https://github.com/mautic/mautic-tester) +### PHP options +- `-e PHP_INI_DATE_TIMEZONE=...` (defaults to `UTC`) Set PHP timezone +- `-e PHP_MEMORY_LIMIT=...` (defaults to `256M`) Set PHP memory limit +- `-e PHP_MAX_UPLOAD=...` (defaults to `20M`) Set PHP upload max file size +- `-e PHP_MAX_EXECUTION_TIME=...` (defaults to `300`) Set PHP max execution time + +### PHP options +- `-e PHP_INI_DATE_TIMEZONE=...` (defaults to `UTC`) Set PHP timezone +- `-e PHP_MEMORY_LIMIT=...` (defaults to `256M`) Set PHP memory limit +- `-e PHP_MAX_UPLOAD=...` (defaults to `20M`) Set PHP upload max file size +- `-e PHP_MAX_EXECUTION_TIME=...` (defaults to `300`) Set PHP max execution time + ### Persistent Data Volumes diff --git a/apache/Dockerfile b/apache/Dockerfile index 03312121..2d8ed73f 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -43,6 +43,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ @@ -57,7 +63,6 @@ COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic RUN chmod 644 /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Enable Apache Rewrite Module RUN a2enmod rewrite diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index a5b4932d..0445448a 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -1,6 +1,19 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 +memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On +upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' diff --git a/apache/makeconfig.php b/apache/makeconfig.php index 41134d24..0db32904 100755 --- a/apache/makeconfig.php +++ b/apache/makeconfig.php @@ -36,6 +36,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = " /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 +memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On +upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +137,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/beta-apache/makeconfig.php b/beta-apache/makeconfig.php index ecc5a1c8..b0640797 100644 --- a/beta-apache/makeconfig.php +++ b/beta-apache/makeconfig.php @@ -33,6 +33,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = " /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 +memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On +upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +137,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/beta-fpm/makeconfig.php b/beta-fpm/makeconfig.php index ecc5a1c8..b0640797 100644 --- a/beta-fpm/makeconfig.php +++ b/beta-fpm/makeconfig.php @@ -33,6 +33,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = " /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 +memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On +upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -15,7 +28,6 @@ if [ -n "$MYSQL_PORT_3306_TCP" ]; then fi - if [ -z "$MAUTIC_DB_HOST" ]; then echo >&2 "error: missing MAUTIC_DB_HOST and MYSQL_PORT_3306_TCP environment variables" echo >&2 " Did you forget to --link some_mysql_container:mysql or set an external db" diff --git a/common/makeconfig.php b/common/makeconfig.php index 41134d24..0db32904 100644 --- a/common/makeconfig.php +++ b/common/makeconfig.php @@ -36,6 +36,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = " /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 +memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On +upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' diff --git a/fpm/makeconfig.php b/fpm/makeconfig.php index 41134d24..0db32904 100755 --- a/fpm/makeconfig.php +++ b/fpm/makeconfig.php @@ -36,6 +36,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = "