├── testing ├── secure-user.sql ├── config.test.inc.php ├── config.user.inc.php ├── Dockerfile ├── conftest.py ├── generate-keys.sh ├── docker-compose │ ├── docker-compose.testing-one-host.yml │ ├── docker-compose.testing-config-mount-dir.yml │ ├── docker-compose.testing-default.yml │ ├── docker-compose.testing-different-apache-port.yml │ ├── docker-compose.testing-one-socket-host.yml │ ├── docker-compose.testing-run-as-www-data.yml │ ├── docker-compose.testing-fs-import-export.yml │ └── docker-compose.testing-one-ssl-host.yml ├── test-docker.sh └── phpmyadmin_test.py ├── .gitattributes ├── .gitignore ├── hooks └── build ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── ci.yml │ └── run-tests.yml ├── docker-compose.yml ├── Makefile ├── fpm ├── docker-entrypoint.sh ├── helpers.php ├── Dockerfile └── config.inc.php ├── fpm-alpine ├── docker-entrypoint.sh ├── helpers.php ├── Dockerfile └── config.inc.php ├── helpers.php ├── apache ├── helpers.php ├── docker-entrypoint.sh ├── Dockerfile └── config.inc.php ├── docker-entrypoint.sh ├── generate-stackbrew-library.sh ├── update.sh ├── CHANGELOG.md ├── Dockerfile-alpine.template ├── Dockerfile-debian.template ├── config.inc.php ├── README.md └── LICENSE /testing/secure-user.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sql linguist-detectable=false 2 | -------------------------------------------------------------------------------- /testing/config.test.inc.php: -------------------------------------------------------------------------------- 1 | instead. 5 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | phpmyadmin: 2 | image: phpmyadmin 3 | container_name: phpmyadmin 4 | environment: 5 | - PMA_ARBITRARY=1 6 | restart: always 7 | ports: 8 | - 8080:80 9 | volumes: 10 | - /sessions 11 | -------------------------------------------------------------------------------- /testing/Dockerfile: -------------------------------------------------------------------------------- 1 | # Testing image for phpMyAdmin 2 | 3 | FROM alpine:3.21 4 | 5 | # Install test dependencies 6 | RUN set -ex; \ 7 | \ 8 | apk add --no-cache --update mariadb-client mariadb-connector-c bash \ 9 | py3-html5lib py3-pytest py3-mechanize curl 10 | -------------------------------------------------------------------------------- /testing/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | def pytest_addoption(parser): 4 | parser.addoption("--url") 5 | parser.addoption("--username") 6 | parser.addoption("--password") 7 | parser.addoption("--root-password") 8 | parser.addoption("--server") 9 | parser.addoption("--sqlfile") 10 | 11 | @pytest.fixture 12 | def url(request): 13 | return request.config.getoption("--url") 14 | 15 | @pytest.fixture 16 | def username(request): 17 | return request.config.getoption("--username") 18 | 19 | @pytest.fixture 20 | def password(request): 21 | return request.config.getoption("--password") 22 | 23 | @pytest.fixture 24 | def root_password(request): 25 | return request.config.getoption("--root-password") 26 | 27 | @pytest.fixture 28 | def server(request): 29 | return request.config.getoption("--server") 30 | 31 | @pytest.fixture 32 | def sqlfile(request): 33 | return request.config.getoption("--sqlfile") 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_REPO = phpmyadmin 2 | 3 | .PHONY: all build run logs clean stop rm prune 4 | 5 | all: build run logs 6 | 7 | build: build-apache build-fpm build-fpm-alpine 8 | 9 | build-apache: 10 | docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing apache 11 | 12 | build-fpm: 13 | docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm fpm 14 | 15 | build-fpm-alpine: 16 | docker build ${DOCKER_FLAGS} -t ${DOCKER_REPO}:testing-fpm-alpine fpm-alpine 17 | 18 | run: 19 | docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml up -d 20 | 21 | testing-%: 22 | docker compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml up --build --abort-on-container-exit --exit-code-from=sut 23 | docker compose -p "phpmyadmin_$@" -f ./testing/docker-compose/docker-compose.$@.yml down 24 | 25 | run-tests: testing-default testing-one-host testing-one-socket-host testing-config-mount-dir testing-fs-import-export testing-different-apache-port testing-run-as-www-data testing-one-ssl-host 26 | 27 | logs: 28 | docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml logs 29 | 30 | clean: stop rm prune 31 | 32 | stop: 33 | docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml stop 34 | 35 | rm: 36 | docker compose -f ./testing/docker-compose/docker-compose.testing-default.yml rm 37 | 38 | prune: 39 | docker rm `docker ps -q -a --filter status=exited` 40 | docker rmi `docker images -q --filter "dangling=true"` 41 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | permissions: 4 | contents: read 5 | 6 | on: 7 | pull_request: 8 | push: 9 | schedule: 10 | - cron: 0 0 * * 0 11 | 12 | defaults: 13 | run: 14 | shell: 'bash -Eeuo pipefail -x {0}' 15 | 16 | jobs: 17 | 18 | generate-jobs: 19 | name: Generate Jobs 20 | runs-on: ubuntu-latest 21 | outputs: 22 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 23 | steps: 24 | - uses: actions/checkout@v4 25 | - uses: docker-library/bashbrew@v0.1.12 26 | - id: generate-jobs 27 | name: Generate Jobs 28 | run: | 29 | strategy="$(GITHUB_REPOSITORY=phpmyadmin "$BASHBREW_SCRIPTS/github-actions/generate.sh")" 30 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 31 | jq . <<<"$strategy" # sanity check / debugging aid 32 | 33 | test: 34 | needs: generate-jobs 35 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 36 | name: ${{ matrix.name }} 37 | runs-on: ${{ matrix.os }} 38 | steps: 39 | - uses: actions/checkout@v4 40 | - name: Prepare Environment 41 | run: ${{ matrix.runs.prepare }} 42 | - name: Pull Dependencies 43 | run: ${{ matrix.runs.pull }} 44 | - name: Build ${{ matrix.name }} 45 | run: ${{ matrix.runs.build }} 46 | - name: History ${{ matrix.name }} 47 | run: ${{ matrix.runs.history }} 48 | - name: Test ${{ matrix.name }} 49 | run: ${{ matrix.runs.test }} 50 | - name: '"docker images"' 51 | run: ${{ matrix.runs.images }} 52 | -------------------------------------------------------------------------------- /testing/generate-keys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | # Source: https://github.com/chio-nzgft/docker-MariaDB-with-SSL 6 | # See: https://dev.mysql.com/doc/refman/5.7/en/creating-ssl-files-using-openssl.html 7 | 8 | 9 | ROOT_DIR="$(realpath $(dirname $0))" 10 | echo "Using root dir: $ROOT_DIR" 11 | 12 | cd "$ROOT_DIR" 13 | 14 | rm -f *.pem 15 | 16 | SUBJECT_CA="/C=US/O=phpMyAdmin testing/OU=Docker/CN=ssl-ca.phpmyadmin.local/emailAddress=ssl-ca@example.org" 17 | SUBJECT_CLIENT="/C=US/O=phpMyAdmin testing/OU=Docker/CN=client.phpmyadmin.local/emailAddress=secure-user@example.org" 18 | SUBJECT_SERVER="/C=US/O=phpMyAdmin testing/OU=Docker/CN=mariadb.phpmyadmin.local" 19 | 20 | echo "CA key" 21 | 22 | openssl genrsa 2048 > ca-key.pem 23 | openssl req -new -x509 -nodes -days 3600 -subj "${SUBJECT_CA}" -key ca-key.pem -out ca-cert.pem 24 | echo "server key" 25 | 26 | openssl req -subj "${SUBJECT_SERVER}" -newkey rsa:2048 -days 3600 -nodes -keyout server-key.pem -out server-req.pem 27 | openssl rsa -in server-key.pem -out server-key.pem 28 | openssl x509 -req -in server-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem 29 | echo "client key" 30 | 31 | openssl req -subj "${SUBJECT_CLIENT}" -newkey rsa:2048 -days 3600 -nodes -keyout client-key.pem -out client-req.pem 32 | openssl rsa -in client-key.pem -out client-key.pem 33 | openssl x509 -req -in client-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem 34 | echo "check key ok" 35 | 36 | openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem 37 | chmod 666 *.pem 38 | -------------------------------------------------------------------------------- /fpm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 3 | 4 | if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then 5 | cat > /etc/phpmyadmin/config.secret.inc.php < $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini 20 | fi 21 | 22 | if [ ! -z "${PMA_CONFIG_BASE64}" ]; then 23 | echo "Adding the custom config.inc.php from base64." 24 | echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php 25 | fi 26 | 27 | if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then 28 | echo "Adding the custom config.user.inc.php from base64." 29 | echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php 30 | fi 31 | 32 | 33 | get_docker_secret() { 34 | local env_var="${1}" 35 | local env_var_file="${env_var}_FILE" 36 | 37 | # Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example) 38 | # is not empty and export $PMA_PASSWORD as the password in the Docker secrets file 39 | 40 | if [[ -n "${!env_var_file}" ]]; then 41 | export "${env_var}"="$(cat "${!env_var_file}")" 42 | fi 43 | } 44 | 45 | get_docker_secret PMA_USER 46 | get_docker_secret PMA_PASSWORD 47 | get_docker_secret MYSQL_ROOT_PASSWORD 48 | get_docker_secret MYSQL_PASSWORD 49 | get_docker_secret PMA_HOSTS 50 | get_docker_secret PMA_HOST 51 | get_docker_secret PMA_CONTROLHOST 52 | get_docker_secret PMA_CONTROLUSER 53 | get_docker_secret PMA_CONTROLPASS 54 | 55 | exec "$@" 56 | -------------------------------------------------------------------------------- /fpm-alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 3 | 4 | if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then 5 | cat > /etc/phpmyadmin/config.secret.inc.php < $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini 20 | fi 21 | 22 | if [ ! -z "${PMA_CONFIG_BASE64}" ]; then 23 | echo "Adding the custom config.inc.php from base64." 24 | echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php 25 | fi 26 | 27 | if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then 28 | echo "Adding the custom config.user.inc.php from base64." 29 | echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php 30 | fi 31 | 32 | 33 | get_docker_secret() { 34 | local env_var="${1}" 35 | local env_var_file="${env_var}_FILE" 36 | 37 | # Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example) 38 | # is not empty and export $PMA_PASSWORD as the password in the Docker secrets file 39 | 40 | if [[ -n "${!env_var_file}" ]]; then 41 | export "${env_var}"="$(cat "${!env_var_file}")" 42 | fi 43 | } 44 | 45 | get_docker_secret PMA_USER 46 | get_docker_secret PMA_PASSWORD 47 | get_docker_secret MYSQL_ROOT_PASSWORD 48 | get_docker_secret MYSQL_PASSWORD 49 | get_docker_secret PMA_HOSTS 50 | get_docker_secret PMA_HOST 51 | get_docker_secret PMA_CONTROLHOST 52 | get_docker_secret PMA_CONTROLUSER 53 | get_docker_secret PMA_CONTROLPASS 54 | 55 | exec "$@" 56 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-one-host.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:10.11} 6 | environment: 7 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 8 | healthcheck: 9 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"] 10 | start_period: 10s 11 | interval: 5s 12 | timeout: 60s 13 | retries: 10 14 | networks: 15 | testing: 16 | aliases: 17 | - phpmyadmin_testing_db 18 | tmpfs: 19 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 20 | 21 | phpmyadmin: 22 | build: 23 | context: ../../apache 24 | environment: 25 | PMA_HOST: db_server 26 | UPLOAD_LIMIT: 123M 27 | MAX_EXECUTION_TIME: 125 28 | HIDE_PHP_VERSION: 1 29 | volumes: 30 | - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro 31 | healthcheck: 32 | test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"] 33 | start_period: 5s 34 | interval: 3s 35 | timeout: 60s 36 | retries: 10 37 | networks: 38 | testing: 39 | aliases: 40 | - phpmyadmin_testing_apache 41 | depends_on: 42 | db_server: 43 | condition: service_healthy 44 | 45 | sut: 46 | depends_on: 47 | phpmyadmin: 48 | condition: service_healthy 49 | db_server: 50 | condition: service_healthy 51 | build: 52 | context: ../ 53 | command: "/tests/testing/test-docker.sh" 54 | networks: 55 | testing: 56 | environment: 57 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 58 | TESTSUITE_PORT: 80 59 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 60 | PMA_HOST: phpmyadmin_testing_db 61 | PMA_PORT: 3306 62 | volumes: 63 | - ../../:/tests:ro 64 | - /var/run/docker.sock:/var/run/docker.sock 65 | working_dir: /tests 66 | 67 | networks: 68 | testing: 69 | driver: bridge 70 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-config-mount-dir.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:10.11} 6 | environment: 7 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 8 | healthcheck: 9 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"] 10 | start_period: 10s 11 | interval: 5s 12 | timeout: 60s 13 | retries: 10 14 | networks: 15 | testing: 16 | aliases: 17 | - phpmyadmin_testing_db 18 | tmpfs: 19 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 20 | 21 | phpmyadmin: 22 | build: 23 | context: ../../apache 24 | environment: 25 | PMA_HOST: db_server 26 | UPLOAD_LIMIT: 123M 27 | MAX_EXECUTION_TIME: 125 28 | HIDE_PHP_VERSION: 1 29 | volumes: 30 | - ../config.user.inc.php:/etc/phpmyadmin/conf.d/config.test.php:ro 31 | healthcheck: 32 | test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"] 33 | start_period: 5s 34 | interval: 3s 35 | timeout: 60s 36 | retries: 10 37 | networks: 38 | testing: 39 | aliases: 40 | - phpmyadmin_testing_apache 41 | depends_on: 42 | db_server: 43 | condition: service_healthy 44 | 45 | sut: 46 | depends_on: 47 | phpmyadmin: 48 | condition: service_healthy 49 | db_server: 50 | condition: service_healthy 51 | build: 52 | context: ../ 53 | command: "/tests/testing/test-docker.sh" 54 | networks: 55 | testing: 56 | environment: 57 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 58 | TESTSUITE_PORT: 80 59 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 60 | PMA_HOST: phpmyadmin_testing_db 61 | PMA_PORT: 3306 62 | volumes: 63 | - ../../:/tests:ro 64 | - /var/run/docker.sock:/var/run/docker.sock 65 | working_dir: /tests 66 | 67 | networks: 68 | testing: 69 | driver: bridge 70 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-default.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:10.11} 6 | environment: 7 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 8 | healthcheck: 9 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"] 10 | start_period: 10s 11 | interval: 5s 12 | timeout: 60s 13 | retries: 10 14 | networks: 15 | testing: 16 | aliases: 17 | - phpmyadmin_testing_db 18 | tmpfs: 19 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 20 | 21 | phpmyadmin: 22 | build: 23 | context: ../../apache 24 | environment: 25 | PMA_ARBITRARY: 1 26 | UPLOAD_LIMIT: 123M 27 | MAX_EXECUTION_TIME: 125 28 | HIDE_PHP_VERSION: 1 29 | volumes: 30 | - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro 31 | healthcheck: 32 | test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"] 33 | start_period: 5s 34 | interval: 3s 35 | timeout: 60s 36 | retries: 10 37 | networks: 38 | testing: 39 | aliases: 40 | - phpmyadmin_testing_apache 41 | depends_on: 42 | db_server: 43 | condition: service_healthy 44 | 45 | sut: 46 | depends_on: 47 | phpmyadmin: 48 | condition: service_healthy 49 | db_server: 50 | condition: service_healthy 51 | build: 52 | context: ../ 53 | command: "/tests/testing/test-docker.sh" 54 | networks: 55 | testing: 56 | environment: 57 | TESTSUITE_HOSTNAME_ARBITRARY: 1 58 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 59 | PMA_HOST: phpmyadmin_testing_db 60 | TESTSUITE_PORT: 80 61 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 62 | volumes: 63 | - ../../:/tests:ro 64 | - /var/run/docker.sock:/var/run/docker.sock 65 | working_dir: /tests 66 | 67 | networks: 68 | testing: 69 | driver: bridge 70 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-different-apache-port.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:10.11} 6 | environment: 7 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 8 | healthcheck: 9 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"] 10 | start_period: 10s 11 | interval: 5s 12 | timeout: 60s 13 | retries: 10 14 | networks: 15 | testing: 16 | aliases: 17 | - phpmyadmin_testing_db 18 | tmpfs: 19 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 20 | 21 | phpmyadmin: 22 | build: 23 | context: ../../apache 24 | environment: 25 | PMA_HOST: db_server 26 | UPLOAD_LIMIT: 123M 27 | MAX_EXECUTION_TIME: 125 28 | HIDE_PHP_VERSION: 1 29 | APACHE_PORT: 8090 30 | volumes: 31 | - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro 32 | healthcheck: 33 | test: ["CMD", "curl", "-Ss", "http://localhost:8090/robots.txt"] 34 | start_period: 5s 35 | interval: 3s 36 | timeout: 60s 37 | retries: 10 38 | networks: 39 | testing: 40 | aliases: 41 | - phpmyadmin_testing_apache 42 | depends_on: 43 | db_server: 44 | condition: service_healthy 45 | 46 | sut: 47 | depends_on: 48 | phpmyadmin: 49 | condition: service_healthy 50 | db_server: 51 | condition: service_healthy 52 | build: 53 | context: ../ 54 | command: "/tests/testing/test-docker.sh" 55 | networks: 56 | testing: 57 | environment: 58 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 59 | TESTSUITE_PORT: 8090 60 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 61 | PMA_HOST: phpmyadmin_testing_db 62 | PMA_PORT: 3306 63 | volumes: 64 | - ../../:/tests:ro 65 | - /var/run/docker.sock:/var/run/docker.sock 66 | working_dir: /tests 67 | 68 | networks: 69 | testing: 70 | driver: bridge 71 | -------------------------------------------------------------------------------- /helpers.php: -------------------------------------------------------------------------------- 1 | /etc/phpmyadmin/config.secret.inc.php < $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini 20 | fi 21 | 22 | if [ ! -z "${PMA_CONFIG_BASE64}" ]; then 23 | echo "Adding the custom config.inc.php from base64." 24 | echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php 25 | fi 26 | 27 | if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then 28 | echo "Adding the custom config.user.inc.php from base64." 29 | echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php 30 | fi 31 | 32 | # start: Apache specific settings 33 | if [ -n "${APACHE_PORT+x}" ]; then 34 | echo "Setting apache port to ${APACHE_PORT}." 35 | sed -i "/VirtualHost \*:80/c\\" /etc/apache2/sites-enabled/000-default.conf 36 | sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf 37 | apachectl configtest 38 | fi 39 | # end: Apache specific settings 40 | 41 | get_docker_secret() { 42 | local env_var="${1}" 43 | local env_var_file="${env_var}_FILE" 44 | 45 | # Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example) 46 | # is not empty and export $PMA_PASSWORD as the password in the Docker secrets file 47 | 48 | if [[ -n "${!env_var_file}" ]]; then 49 | export "${env_var}"="$(cat "${!env_var_file}")" 50 | fi 51 | } 52 | 53 | get_docker_secret PMA_USER 54 | get_docker_secret PMA_PASSWORD 55 | get_docker_secret MYSQL_ROOT_PASSWORD 56 | get_docker_secret MYSQL_PASSWORD 57 | get_docker_secret PMA_HOSTS 58 | get_docker_secret PMA_HOST 59 | get_docker_secret PMA_CONTROLHOST 60 | get_docker_secret PMA_CONTROLUSER 61 | get_docker_secret PMA_CONTROLPASS 62 | 63 | exec "$@" 64 | -------------------------------------------------------------------------------- /apache/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 3 | 4 | if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then 5 | cat > /etc/phpmyadmin/config.secret.inc.php < $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini 20 | fi 21 | 22 | if [ ! -z "${PMA_CONFIG_BASE64}" ]; then 23 | echo "Adding the custom config.inc.php from base64." 24 | echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php 25 | fi 26 | 27 | if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then 28 | echo "Adding the custom config.user.inc.php from base64." 29 | echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php 30 | fi 31 | 32 | # start: Apache specific settings 33 | if [ -n "${APACHE_PORT+x}" ]; then 34 | echo "Setting apache port to ${APACHE_PORT}." 35 | sed -i "/VirtualHost \*:80/c\\" /etc/apache2/sites-enabled/000-default.conf 36 | sed -i "/Listen 80/c\Listen ${APACHE_PORT}" /etc/apache2/ports.conf 37 | apachectl configtest 38 | fi 39 | # end: Apache specific settings 40 | 41 | get_docker_secret() { 42 | local env_var="${1}" 43 | local env_var_file="${env_var}_FILE" 44 | 45 | # Check if the variable with name $env_var_file (which is $PMA_PASSWORD_FILE for example) 46 | # is not empty and export $PMA_PASSWORD as the password in the Docker secrets file 47 | 48 | if [[ -n "${!env_var_file}" ]]; then 49 | export "${env_var}"="$(cat "${!env_var_file}")" 50 | fi 51 | } 52 | 53 | get_docker_secret PMA_USER 54 | get_docker_secret PMA_PASSWORD 55 | get_docker_secret MYSQL_ROOT_PASSWORD 56 | get_docker_secret MYSQL_PASSWORD 57 | get_docker_secret PMA_HOSTS 58 | get_docker_secret PMA_HOST 59 | get_docker_secret PMA_CONTROLHOST 60 | get_docker_secret PMA_CONTROLUSER 61 | get_docker_secret PMA_CONTROLPASS 62 | 63 | exec "$@" 64 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-fs-import-export.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:10.11} 6 | environment: 7 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 8 | healthcheck: 9 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"] 10 | start_period: 10s 11 | interval: 5s 12 | timeout: 60s 13 | retries: 10 14 | networks: 15 | testing: 16 | aliases: 17 | - phpmyadmin_testing_db 18 | tmpfs: 19 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 20 | 21 | phpmyadmin: 22 | build: 23 | context: ../../apache 24 | environment: 25 | PMA_HOST: db_server 26 | UPLOAD_LIMIT: 123M 27 | MAX_EXECUTION_TIME: 125 28 | HIDE_PHP_VERSION: 1 29 | PMA_UPLOADDIR: /etc/phpmyadmin/imports 30 | PMA_SAVEDIR: /etc/phpmyadmin/exports 31 | volumes: 32 | - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro 33 | - phpmyadmin-data:/etc/phpmyadmin/imports:ro 34 | - phpmyadmin-data:/etc/phpmyadmin/exports 35 | healthcheck: 36 | test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"] 37 | start_period: 5s 38 | interval: 3s 39 | timeout: 60s 40 | retries: 10 41 | networks: 42 | testing: 43 | aliases: 44 | - phpmyadmin_testing_apache 45 | depends_on: 46 | db_server: 47 | condition: service_healthy 48 | 49 | sut: 50 | depends_on: 51 | phpmyadmin: 52 | condition: service_healthy 53 | db_server: 54 | condition: service_healthy 55 | build: 56 | context: ../ 57 | command: "/tests/testing/test-docker.sh" 58 | networks: 59 | testing: 60 | environment: 61 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 62 | TESTSUITE_PORT: 80 63 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 64 | PMA_HOST: phpmyadmin_testing_db 65 | PMA_PORT: 3306 66 | PMA_UPLOADDIR: /etc/phpmyadmin/imports 67 | PMA_SAVEDIR: /etc/phpmyadmin/exports 68 | volumes: 69 | - ../../:/tests:ro 70 | - /var/run/docker.sock:/var/run/docker.sock 71 | - phpmyadmin-data:/etc/phpmyadmin/imports 72 | - phpmyadmin-data:/etc/phpmyadmin/exports 73 | working_dir: /tests 74 | 75 | networks: 76 | testing: 77 | driver: bridge 78 | 79 | volumes: 80 | phpmyadmin-data: 81 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | self="$(basename "$BASH_SOURCE")" 5 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 6 | 7 | # get the most recent commit which modified any of "$@" 8 | fileCommit() { 9 | git log -1 --format='format:%H' HEAD -- "$@" 10 | } 11 | 12 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 13 | dirCommit() { 14 | local dir="$1"; shift 15 | ( 16 | cd "$dir" 17 | fileCommit \ 18 | Dockerfile \ 19 | $(git show HEAD:./Dockerfile | awk ' 20 | toupper($1) == "COPY" { 21 | for (i = 2; i < NF; i++) { 22 | print $i 23 | } 24 | } 25 | ') 26 | ) 27 | } 28 | 29 | getArches() { 30 | local repo="$1"; shift 31 | local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' 32 | 33 | eval "declare -A -g parentRepoToArches=( $( 34 | find -name 'Dockerfile' -exec awk ' 35 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { 36 | print "'"$officialImagesUrl"'" $2 37 | } 38 | ' '{}' + \ 39 | | sort -u \ 40 | | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' 41 | ) )" 42 | } 43 | getArches 'phpmyadmin' 44 | 45 | if ! command -v bashbrew --version &> /dev/null 46 | then 47 | echo "bashbrew could not be found" 48 | echo "You can download it from Jenkins at https://github.com/docker-library/bashbrew#installing" 49 | exit 1 50 | fi 51 | 52 | cat <<-EOH 53 | # This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self 54 | Maintainers: Isaac Bennetch (@ibennetch), 55 | William Desportes (@williamdes) 56 | GitRepo: https://github.com/phpmyadmin/docker.git 57 | EOH 58 | 59 | # prints "$2$1$3$1...$N" 60 | join() { 61 | local sep="$1"; shift 62 | local out; printf -v out "${sep//%/%%}%s" "$@" 63 | echo "${out#$sep}" 64 | } 65 | 66 | latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')" 67 | 68 | for variant in apache fpm fpm-alpine; do 69 | commit="$(dirCommit "$variant")" 70 | fullversion="$(git show "$commit":"$variant/Dockerfile" | awk -F" |=" '$1 == "ENV" && $2 == "VERSION" { print $3; exit }')" 71 | 72 | versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" ) 73 | if [ "$fullversion" = "$latest" ]; then 74 | versionAliases+=( "latest" ) 75 | fi 76 | 77 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 78 | variantAliases=( "${variantAliases[@]//latest-}" ) 79 | 80 | if [ "$variant" = "apache" ]; then 81 | variantAliases+=( "${versionAliases[@]}" ) 82 | fi 83 | 84 | variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")" 85 | 86 | variantArches="${parentRepoToArches[$variantParent]}" 87 | 88 | cat <<-EOE 89 | 90 | Tags: $(join ', ' "${variantAliases[@]}") 91 | Architectures: $(join ', ' $variantArches) 92 | GitCommit: $commit 93 | Directory: $variant 94 | EOE 95 | done 96 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: Internal test suite 2 | 3 | permissions: 4 | contents: read 5 | 6 | on: 7 | pull_request: 8 | push: 9 | 10 | jobs: 11 | test-apache-container: 12 | name: Test (${{ matrix.configuration }}) on database ${{ matrix.database-image }} 13 | runs-on: ubuntu-latest 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | database-image: [ 18 | "mariadb:10.6", 19 | "mariadb:10.11", 20 | "mariadb:11.4", 21 | "mariadb:latest", 22 | "mysql:5.7", 23 | "mysql:8.4", 24 | "mysql:latest" 25 | ] 26 | configuration: [ 27 | "default", 28 | "one-host", 29 | "one-socket-host", 30 | "config-mount-dir", 31 | "fs-import-export", 32 | "different-apache-port", 33 | "run-as-www-data" 34 | ] 35 | include: 36 | - { 37 | database-image: "mariadb:10.6", 38 | configuration: "one-ssl-host" 39 | } 40 | - { 41 | database-image: "mariadb:10.11", 42 | configuration: "one-ssl-host" 43 | } 44 | - { 45 | database-image: "mariadb:11.4", 46 | configuration: "one-ssl-host" 47 | } 48 | - { 49 | database-image: "mariadb:latest", 50 | configuration: "one-ssl-host" 51 | } 52 | 53 | steps: 54 | - uses: actions/checkout@v4 55 | - name: Generate the testing keys 56 | if: ${{ contains(matrix.configuration, 'one-ssl-host') }} 57 | run: ./testing/generate-keys.sh 58 | - name: Switch to MySQL compatible ENVs 59 | if: ${{ contains(matrix.database-image, 'mysql') }} 60 | working-directory: ./testing/docker-compose/ 61 | run: sed -i 's/MARIADB_ROOT_PASSWORD/MYSQL_ROOT_PASSWORD/' ./docker-compose.testing-${{ matrix.configuration }}.yml 62 | - name: Switch to MySQL compatible healthcheck 63 | if: ${{ contains(matrix.database-image, 'mysql') }} 64 | working-directory: ./testing/docker-compose/ 65 | run: sed -i 's/mariadb-admin/mysqladmin/' ./docker-compose.testing-${{ matrix.configuration }}.yml 66 | - name: Build images 67 | working-directory: ./testing/ 68 | run: docker compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml build 69 | - name: Run ${{ matrix.configuration }} tests 70 | working-directory: ./testing/ 71 | run: docker compose -f ./docker-compose/docker-compose.testing-${{ matrix.configuration }}.yml up --build --abort-on-container-exit --exit-code-from=sut 72 | env: 73 | DB: ${{ matrix.database-image }} 74 | -------------------------------------------------------------------------------- /testing/docker-compose/docker-compose.testing-one-ssl-host.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | db_server: 5 | image: ${DB:-mariadb:11} 6 | command: 7 | - "--ssl-ca=/etc/phpmyadmin/ssl/ca-cert.pem" 8 | - "--ssl-cert=/etc/phpmyadmin/ssl/server-cert.pem" 9 | - "--ssl-key=/etc/phpmyadmin/ssl/server-key.pem" 10 | - "--require-secure-transport=ON" 11 | environment: 12 | MARIADB_USER: secure-user 13 | MARIADB_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 14 | MARIADB_ROOT_PASSWORD: "${TESTSUITE_ROOT_PASSWORD:-random-pass}" 15 | # The database name used in the import test 16 | MARIADB_DATABASE: World 17 | healthcheck: 18 | test: ["CMD", "mariadb-admin", "ping", "-uroot", "-prandom-pass"] 19 | start_period: 10s 20 | interval: 5s 21 | timeout: 60s 22 | retries: 10 23 | networks: 24 | testing: 25 | aliases: 26 | - mariadb.phpmyadmin.local 27 | tmpfs: 28 | - /var/lib/mysql:rw,noexec,nosuid,size=300m 29 | volumes: 30 | #- ../secure-user.sql:/docker-entrypoint-initdb.d/secure-user.sql:ro 31 | - ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro 32 | - ../ca-key.pem:/etc/phpmyadmin/ssl/ca-key.pem:ro 33 | - ../server-cert.pem:/etc/phpmyadmin/ssl/server-cert.pem:ro 34 | - ../server-key.pem:/etc/phpmyadmin/ssl/server-key.pem:ro 35 | #- ../mariadb-audit:/var/log/mariadb-audit 36 | 37 | phpmyadmin: 38 | build: 39 | context: ../../apache 40 | environment: 41 | PMA_HOST: mariadb.phpmyadmin.local 42 | PMA_SSL: 1 43 | PMA_SSL_VERIFY: 1 44 | PMA_SSL_CA: /etc/phpmyadmin/ssl/ca-cert.pem 45 | PMA_SSL_CERT: /etc/phpmyadmin/ssl/client-cert.pem 46 | PMA_SSL_KEY: /etc/phpmyadmin/ssl/client-key.pem 47 | UPLOAD_LIMIT: 123M 48 | MAX_EXECUTION_TIME: 125 49 | HIDE_PHP_VERSION: 1 50 | volumes: 51 | - ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro 52 | - ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro 53 | - ../client-cert.pem:/etc/phpmyadmin/ssl/client-cert.pem:ro 54 | - ../client-key.pem:/etc/phpmyadmin/ssl/client-key.pem:ro 55 | healthcheck: 56 | test: ["CMD", "curl", "-Ss", "http://localhost/robots.txt"] 57 | start_period: 5s 58 | interval: 3s 59 | timeout: 60s 60 | retries: 10 61 | networks: 62 | testing: 63 | aliases: 64 | - phpmyadmin_testing_apache 65 | depends_on: 66 | db_server: 67 | condition: service_healthy 68 | 69 | sut: 70 | depends_on: 71 | phpmyadmin: 72 | condition: service_healthy 73 | db_server: 74 | condition: service_healthy 75 | build: 76 | context: ../ 77 | command: "/tests/testing/test-docker.sh" 78 | networks: 79 | testing: 80 | environment: 81 | TESTSUITE_HOSTNAME: phpmyadmin_testing_apache 82 | TESTSUITE_PORT: 80 83 | TESTSUITE_USER: secure-user 84 | TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}" 85 | TESTSUITE_ROOT_PASSWORD: "${TESTSUITE_ROOT_PASSWORD:-random-pass}" 86 | PMA_HOST: mariadb.phpmyadmin.local 87 | PMA_PORT: 3306 88 | IS_USING_SSL: true 89 | volumes: 90 | - ../ca-cert.pem:/etc/phpmyadmin/ssl/ca-cert.pem:ro 91 | - ../server-cert.pem:/etc/phpmyadmin/ssl/server-cert.pem:ro 92 | - ../client-cert.pem:/etc/phpmyadmin/ssl/client-cert.pem:ro 93 | - ../client-key.pem:/etc/phpmyadmin/ssl/client-key.pem:ro 94 | - ../../:/tests:ro 95 | working_dir: /tests 96 | 97 | networks: 98 | testing: 99 | driver: bridge 100 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu -o pipefail 3 | 4 | variants=( 5 | apache 6 | fpm 7 | fpm-alpine 8 | ) 9 | 10 | declare -A base=( 11 | [apache]='debian' 12 | [fpm]='debian' 13 | [fpm-alpine]='alpine' 14 | ) 15 | 16 | declare -A php_version=( 17 | [default]='8.3' 18 | ) 19 | 20 | declare -A cmd=( 21 | [apache]='apache2-foreground' 22 | [fpm]='php-fpm' 23 | [fpm-alpine]='php-fpm' 24 | ) 25 | 26 | gpg_key='3D06A59ECE730EB71B511C17CE752F178259BD92' 27 | 28 | function download_url() { 29 | echo "https://files.phpmyadmin.net/phpMyAdmin/$1/phpMyAdmin-$1-all-languages.tar.xz" 30 | } 31 | 32 | function create_variant() { 33 | local variant="$1" 34 | local version="$2" 35 | local sha256="$3" 36 | 37 | local branch="$(sed -ne 's/^\([0-9]*\.[0-9]*\)\..*$/\1/p' <<< "$version")" 38 | local url="$(download_url "$version")" 39 | local ascUrl="$(download_url "$version").asc" 40 | local phpVersion="${php_version[$version]-${php_version[default]}}" 41 | 42 | echo "updating $version [$branch] $variant" 43 | 44 | # Create the variant directory with a Dockerfile 45 | mkdir -p "$variant" 46 | 47 | local template="Dockerfile-${base[$variant]}.template" 48 | echo "# DO NOT EDIT: created by update.sh from $template" > "$variant/Dockerfile" 49 | cat "$template" >> "$variant/Dockerfile" 50 | 51 | # Replace Dockerfile variables 52 | sed -ri -e ' 53 | s/%%VARIANT%%/'"$variant"'/; 54 | s/%%VERSION%%/'"$version"'/; 55 | s/%%SHA256%%/'"$sha256"'/; 56 | s/%%DOWNLOAD_URL%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$url")"'/; 57 | s/%%DOWNLOAD_URL_ASC%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$ascUrl")"'/; 58 | s/%%PHP_VERSION%%/'"$phpVersion"'/g; 59 | s/%%GPG_KEY%%/'"$gpg_key"'/g; 60 | s/%%CMD%%/'"${cmd[$variant]}"'/; 61 | ' "$variant/Dockerfile" 62 | 63 | # Copy docker-entrypoint.sh 64 | cp docker-entrypoint.sh "$variant/docker-entrypoint.sh" 65 | if [ "$variant" != "apache" ]; then 66 | sed -i "/^# start: Apache specific settings$/,/^# end: Apache specific settings$/d" "$variant/docker-entrypoint.sh" 67 | sed -i "/^\s*# start: Apache specific build$/,/^\s*# end: Apache specific build$/d" "$variant/Dockerfile" 68 | fi 69 | 70 | # Copy config.inc.php and helpers.php 71 | cp config.inc.php "$variant/config.inc.php" 72 | cp helpers.php "$variant/helpers.php" 73 | 74 | # Add variant to versions.json 75 | versionVariantsJson="$(jq -e \ 76 | --arg branch "$branch" --arg variant "$variant" --arg base "${base[$variant]}" --arg phpVersion "$phpVersion" \ 77 | '.[$branch].variants[$variant] = {"variant": $variant, "base": $base, "phpVersion": $phpVersion}' versions.json)" 78 | versionJson="$(jq -e \ 79 | --arg branch "$branch" --arg version "$version" --arg sha256 "$sha256" --arg url "$url" --arg ascUrl "$ascUrl" --argjson variants "$versionVariantsJson" \ 80 | '.[$branch] = {"branch": $branch, "version": $version, "sha256": $sha256, "url": $url, "ascUrl": $ascUrl, "variants": $variants[$branch].variants}' versions.json)" 81 | printf '%s\n' "$versionJson" > versions.json 82 | } 83 | 84 | # Check script dependencies 85 | command -v curl >/dev/null 2>&1 || { echo >&2 "'curl' is required but not found. Aborting."; exit 1; } 86 | command -v jq >/dev/null 2>&1 || { echo >&2 "'jq' is required but not found. Aborting."; exit 1; } 87 | [ -n "${BASH_VERSINFO}" ] && [ -n "${BASH_VERSINFO[0]}" ] && [ ${BASH_VERSINFO[0]} -ge 4 ] \ 88 | || { echo >&2 "Bash 4.0 or greater is required. Aborting."; exit 1; } 89 | 90 | # Create variants 91 | printf '%s\n' "{}" > versions.json 92 | 93 | latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')" 94 | sha256="$(curl -fsSL "$(download_url "$latest").sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)" 95 | 96 | for variant in "${variants[@]}"; do 97 | create_variant "$variant" "$latest" "$sha256" 98 | done 99 | 100 | # Cleanup the file as for now it's not wanted in the repository 101 | rm versions.json 102 | -------------------------------------------------------------------------------- /testing/test-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | # Set phpMyAdmin environment 6 | PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost} 7 | PHPMYADMIN_PORT=${TESTSUITE_PORT:=80} 8 | PHPMYADMIN_URL=http://${PHPMYADMIN_HOSTNAME}:${PHPMYADMIN_PORT}/ 9 | 10 | # Set database environment 11 | PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost} 12 | PHPMYADMIN_DB_PORT=${PMA_PORT:=3306} 13 | TESTSUITE_USER=${TESTSUITE_USER:=root} 14 | TESTSUITE_ROOT_PASSWORD=${TESTSUITE_ROOT_PASSWORD:-} 15 | 16 | SUBJECT_CA="/C=US/O=phpMyAdmin testing/OU=Docker/CN=ssl-ca.phpmyadmin.local/emailAddress=ssl-ca@example.org" 17 | SUBJECT_CLIENT="/C=US/O=phpMyAdmin testing/OU=Docker/CN=client.phpmyadmin.local/emailAddress=secure-user@example.org" 18 | 19 | if [ "${TESTSUITE_USER}" = "root" ] && [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then 20 | echo "Do not use TESTSUITE_ROOT_PASSWORD with TESTSUITE_USER=root" 21 | exit 1 22 | fi 23 | 24 | TEST_CLI_ARGS="" 25 | if [ -n "${TESTSUITE_HOSTNAME_ARBITRARY:-}" ]; then 26 | TEST_CLI_ARGS="$TEST_CLI_ARGS --server ${PHPMYADMIN_DB_HOSTNAME}" 27 | fi 28 | 29 | if [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then 30 | TEST_CLI_ARGS="$TEST_CLI_ARGS --root-password ${TESTSUITE_ROOT_PASSWORD}" 31 | fi 32 | 33 | # Find test script 34 | if [ -f ./phpmyadmin_test.py ] ; then 35 | FILENAME=./phpmyadmin_test.py 36 | else 37 | FILENAME=./testing/phpmyadmin_test.py 38 | fi 39 | 40 | SSL_FLAG="--skip-ssl" 41 | 42 | if [ -n "${IS_USING_SSL:-}" ]; then 43 | SSL_FLAG="--ssl --ssl-verify-server-cert --ssl-ca=/etc/phpmyadmin/ssl/ca-cert.pem" 44 | fi 45 | 46 | mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"$TESTSUITE_USER" -p"${TESTSUITE_PASSWORD}" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';SHOW VARIABLES LIKE '%ssl%';" 47 | 48 | if [ -n "${IS_USING_SSL:-}" ]; then 49 | set +e 50 | mariadb --skip-ssl -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"$TESTSUITE_USER" -p"${TESTSUITE_PASSWORD}" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null 51 | if [ $? != 1 ]; then 52 | echo "The server does not enforce SSL connections, stopping the test." 53 | exit 1 54 | fi 55 | set -e 56 | fi 57 | 58 | if [ -n "${IS_USING_SSL:-}" ] && [ -n "${TESTSUITE_ROOT_PASSWORD}" ]; then 59 | mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"root" -p"${TESTSUITE_ROOT_PASSWORD}" \ 60 | -e "CREATE USER 'ssl-specific-user'@'%' REQUIRE SUBJECT '$SUBJECT_CLIENT' AND ISSUER '$SUBJECT_CA';" 61 | 62 | set +e 63 | mariadb $SSL_FLAG --ssl-cert=/etc/phpmyadmin/ssl/client-cert.pem --ssl-key=/etc/phpmyadmin/ssl/client-key.pem -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"ssl-specific-user" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null 64 | if [ $? != 0 ]; then 65 | echo "The server should accept the SSL client cert login, stopping the test." 66 | exit 1 67 | fi 68 | set -e 69 | 70 | set +e 71 | mariadb $SSL_FLAG -h "${PHPMYADMIN_DB_HOSTNAME}" -P"${PHPMYADMIN_DB_PORT}" -u"ssl-specific-user" -e "SELECT @@version;SHOW VARIABLES LIKE 'require_secure_transport';" 1> /dev/null 2> /dev/null 72 | if [ $? != 1 ]; then 73 | echo "The server should refuse the login without a client cert, stopping the test." 74 | exit 1 75 | fi 76 | set -e 77 | fi 78 | 79 | ret=$? 80 | 81 | if [ $ret -ne 0 ] ; then 82 | echo "Could not connect to ${PHPMYADMIN_DB_HOSTNAME} on port ${PHPMYADMIN_DB_PORT}" 83 | exit $ret 84 | fi 85 | 86 | curl -fsSL --output /dev/null "${PHPMYADMIN_URL}" 87 | ret=$? 88 | 89 | if [ $ret -ne 0 ] ; then 90 | echo "Could not connect to ${PHPMYADMIN_URL}" 91 | exit $ret 92 | fi 93 | 94 | # Perform tests 95 | ret=0 96 | pytest -p no:cacheprovider -q --url "$PHPMYADMIN_URL" --username $TESTSUITE_USER --password "$TESTSUITE_PASSWORD" $TEST_CLI_ARGS $FILENAME 97 | ret=$? 98 | 99 | # Show debug output in case of failure 100 | if [ $ret -ne 0 ] ; then 101 | ${COMMAND_HOST} ps faux 102 | echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: FAILED" 103 | exit $ret 104 | fi 105 | 106 | echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: SUCCESS" 107 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). 6 | 7 | ## [5.2.3.1] - 2025-10-08 8 | 9 | - Remove leftover uploadprogress.tar.gz download after installation (#465) 10 | 11 | ## [5.2.3] - 2025-10-08 12 | 13 | - Update to PHP 8.3 14 | - Enable the `uploadprogress` extension 15 | 16 | ## [5.2.2] - 2025-01-21 17 | 18 | - Add `TZ` env var to change PHP `date.timezone` (#133) 19 | - Update to PHP 8.2 (#411) 20 | - Add back a `/sessions` volume for sessions persistence (#399) 21 | - Support adding custom configurations in `/etc/phpmyadmin/conf.d` (#401) 22 | - Fix for Debian 12 issue (#416) that caused libraries for extensions to be uninstalled 23 | - Add extension `bcmath` for 2nd factor authentication (#415) 24 | - Refactor `update.sh` (#408) 25 | - Enable remoteip mod for Apache (#434) 26 | - Add support for `PMA_SSL` and `PMA_SSLS` to enable SSL connection (#441) 27 | - Fixed looping through `$sockets` using the same index variable `$i` interferes with the last server id (#186) 28 | - Add support for `PMA_SSL_VERIFY` and `PMA_SSL_VERIFIES` (#448) 29 | - Add support for `PMA_SSL_CA` and `PMA_SSL_CAS` (#448) 30 | - Add support for `PMA_SSL_CERT` and `PMA_SSL_CERTS` (#448) 31 | - Add support for `PMA_SSL_KEY` and `PMA_SSL_KEYS` (#448) 32 | - Also add `PMA_SSL_DIR` to define the dir where SSL files are generated for `_BASE64` prefixed variables 33 | - Support `PMA_SSL_CA_BASE64` and `PMA_SSL_CAS_BASE64` as variables that contain the file contents (#448) 34 | - Support `PMA_SSL_KEY_BASE64` and `PMA_SSL_KEYS_BASE64` as variables that contain the file contents (#448) 35 | - Support `PMA_SSL_CERT_BASE64` and `PMA_SSL_CERTS_BASE64` as variables that contain the file contents (#448) 36 | 37 | ## [5.2.1] - 2023-02-08 38 | 39 | - Move docker-compose test files into a folder 40 | - Fix the section about E2E tests in `README.md` 41 | - Support docker secrets from file for `PMA_USER` (#372) 42 | - Support docker secrets from file for `PMA_CONTROLUSER` (#372) 43 | - Support docker secrets from file for `PMA_CONTROLHOST` (#372) 44 | - Allow a different Apache port with `APACHE_PORT` (#340) 45 | - Add support for ENVs `PMA_UPLOADDIR` and `PMA_SAVEDIR` (#384) 46 | - Fixed a bug with `APACHE_PORT` ENV on container restart (#381) 47 | - Update to PHP 8.1 (#393) 48 | - Add support for ENV `TZ` 49 | 50 | ## [5.1.4] - 2022-05-11 51 | 52 | - Fix incorrect image tag name in `README.md` 53 | 54 | ## [5.1.2] - 2022-01-22 55 | 56 | - Fix GPG keyservers in Dockerfiles 57 | - Remove microbadger badges, it closed 58 | - Improve the README file 59 | - Fix add back composer.json and remove non needed source files (#345) 60 | - Update to PHP 8.0 (#325) 61 | 62 | ## [5.1.1] - 2021-06-04 63 | 64 | - Improve documentation 65 | 66 | ## [5.1.0] - 2021-02-24 67 | 68 | - Set ini setting `max_input_vars = 10000` 69 | - Add support for ENV `PMA_QUERYHISTORYMAX` 70 | - Add support for ENV `MAX_EXECUTION_TIME` 71 | - Add support for ENV `MEMORY_LIMIT` 72 | - Move to GitHub actions 73 | - Re-work the test system 74 | - Support docker secrets from file for `PMA_CONTROLPASS` 75 | - Generate phpmyadmin-misc.ini from ENVs 76 | 77 | ## [4.9.{6,7}] - 2020-10-{10,16} and [5.0.{3,4}] - 2020-10-{10,16} 78 | 79 | - Add `tzdata` package 80 | - Extract downloaded files directly to web root `/var/www/html/` (#277) 81 | - Add SHA checksum when downloading a version 82 | - Improved `UPLOAD_LIMIT` documentation 83 | - Update documentation from `phpmyadmin/phpmyadmin` to `phpmyadmin` 84 | - `phpmyadmin` is now the official image in the Docker official library 85 | 86 | ## [5.0.2] - 2020-03-21 87 | 88 | - Add org.opencontainers.image.* labels 89 | - Apply some feedback from docker-library team to Dockerfiles 90 | 91 | ## [4.9.3] - 2020-01-02 and [5.0.0] - 2019-12-26 92 | 93 | - Add support for ENV `HIDE_PHP_VERSION` to set ini setting `expose_php = Off` 94 | - Add support for ENV `UPLOAD_LIMIT` to set `upload_max_filesize` and `post_max_size` ini settings 95 | - Add support for ENVs `PMA_CONFIG_BASE64` and `PMA_USER_CONFIG_BASE64` (#192) 96 | - Support docker secrets from files for `PMA_PASSWORD`, `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` 97 | - Support docker secrets from files for `PMA_HOSTS` and `PMA_HOST` 98 | 99 | ## [4.9.2-2] - 2020-12-20 100 | 101 | - Update to PHP 7.4 (#257) 102 | - Drop ini setting `opcache.enable_cli=1` 103 | -------------------------------------------------------------------------------- /Dockerfile-alpine.template: -------------------------------------------------------------------------------- 1 | FROM php:%%PHP_VERSION%%-%%VARIANT%% 2 | 3 | ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz" 4 | ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5" 5 | 6 | # install and docker-entrypoint.sh dependencies 7 | RUN apk add --no-cache \ 8 | bash \ 9 | tzdata \ 10 | gnupg 11 | 12 | # Install dependencies 13 | RUN set -ex; \ 14 | \ 15 | apk add --no-cache --virtual .build-deps \ 16 | bzip2-dev \ 17 | freetype-dev \ 18 | libjpeg-turbo-dev \ 19 | libpng-dev \ 20 | libwebp-dev \ 21 | libxpm-dev \ 22 | libzip-dev \ 23 | ; \ 24 | \ 25 | mkdir -p /tmp/uploadprogress; \ 26 | curl -fsSL -o /tmp/uploadprogress/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \ 27 | echo "$UPLOAD_PROGRESS_SHA256 /tmp/uploadprogress/uploadprogress.tar.gz" | sha256sum -c -; \ 28 | tar -xf /tmp/uploadprogress/uploadprogress.tar.gz -C /tmp/uploadprogress --strip-components=1; \ 29 | \ 30 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ 31 | docker-php-ext-install -j "$(nproc)" \ 32 | bz2 \ 33 | gd \ 34 | mysqli \ 35 | opcache \ 36 | zip \ 37 | bcmath \ 38 | /tmp/uploadprogress \ 39 | ; \ 40 | \ 41 | rm -r /tmp/uploadprogress; \ 42 | \ 43 | runDeps="$( \ 44 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 45 | | tr ',' '\n' \ 46 | | sort -u \ 47 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 48 | )"; \ 49 | apk add --no-network --virtual .phpmyadmin-phpexts-rundeps $runDeps; \ 50 | apk del --no-network .build-deps 51 | 52 | # set recommended PHP.ini settings 53 | # see https://secure.php.net/manual/en/opcache.installation.php 54 | ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl 55 | ENV MAX_EXECUTION_TIME=600 56 | ENV MEMORY_LIMIT=512M 57 | ENV UPLOAD_LIMIT=2048K 58 | ENV TZ=UTC 59 | ENV SESSION_SAVE_PATH=/sessions 60 | RUN set -ex; \ 61 | mkdir $SESSION_SAVE_PATH; \ 62 | mkdir -p $PMA_SSL_DIR; \ 63 | chmod 1777 $SESSION_SAVE_PATH; \ 64 | chmod 755 $PMA_SSL_DIR; \ 65 | chown www-data:www-data /etc/phpmyadmin; \ 66 | chown www-data:www-data $PMA_SSL_DIR; \ 67 | chown www-data:www-data $SESSION_SAVE_PATH; \ 68 | \ 69 | { \ 70 | echo 'opcache.memory_consumption=128'; \ 71 | echo 'opcache.interned_strings_buffer=8'; \ 72 | echo 'opcache.max_accelerated_files=4000'; \ 73 | echo 'opcache.revalidate_freq=2'; \ 74 | echo 'opcache.fast_shutdown=1'; \ 75 | } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ 76 | \ 77 | { \ 78 | echo 'session.cookie_httponly=1'; \ 79 | echo 'session.use_strict_mode=1'; \ 80 | } > $PHP_INI_DIR/conf.d/session-strict.ini; \ 81 | \ 82 | { \ 83 | echo 'allow_url_fopen=Off'; \ 84 | echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ 85 | echo 'max_input_vars=10000'; \ 86 | echo 'memory_limit=${MEMORY_LIMIT}'; \ 87 | echo 'post_max_size=${UPLOAD_LIMIT}'; \ 88 | echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ 89 | echo 'date.timezone=${TZ}'; \ 90 | echo 'session.save_path=${SESSION_SAVE_PATH}'; \ 91 | } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini 92 | 93 | USER www-data:www-data 94 | 95 | # Calculate download URL 96 | ENV VERSION=%%VERSION%% 97 | ENV SHA256=%%SHA256%% 98 | ENV URL=https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz 99 | 100 | LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ 101 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ 102 | org.opencontainers.image.authors="The phpMyAdmin Team " \ 103 | org.opencontainers.image.vendor="phpMyAdmin" \ 104 | org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ 105 | org.opencontainers.image.licenses="GPL-2.0-only" \ 106 | org.opencontainers.image.version="${VERSION}" \ 107 | org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ 108 | org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" 109 | 110 | # Download tarball, verify it using gpg and extract 111 | RUN set -ex; \ 112 | \ 113 | export GNUPGHOME="$(mktemp -d)"; \ 114 | export GPGKEY="%%GPG_KEY%%"; \ 115 | curl -fsSL -o phpMyAdmin.tar.xz $URL; \ 116 | curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ 117 | echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ 118 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$GPGKEY" \ 119 | || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ 120 | || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \ 121 | || gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \ 122 | gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ 123 | tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ 124 | mkdir -p /var/www/html/tmp; \ 125 | gpgconf --kill all; \ 126 | rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ 127 | rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \ 128 | grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 129 | sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \ 130 | grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 131 | php -l /var/www/html/libraries/vendor_config.php; \ 132 | find /var/www/html -type d -exec chmod 555 {} \;; \ 133 | find /var/www/html -type f -exec chmod 444 {} \;; \ 134 | chmod 1777 /var/www/html/tmp; 135 | 136 | # Copy configuration 137 | COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php 138 | COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php 139 | 140 | # Copy main script 141 | COPY docker-entrypoint.sh /docker-entrypoint.sh 142 | 143 | USER root 144 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 145 | CMD ["%%CMD%%"] 146 | -------------------------------------------------------------------------------- /fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template 2 | FROM php:8.3-fpm-alpine 3 | 4 | ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz" 5 | ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5" 6 | 7 | # install and docker-entrypoint.sh dependencies 8 | RUN apk add --no-cache \ 9 | bash \ 10 | tzdata \ 11 | gnupg 12 | 13 | # Install dependencies 14 | RUN set -ex; \ 15 | \ 16 | apk add --no-cache --virtual .build-deps \ 17 | bzip2-dev \ 18 | freetype-dev \ 19 | libjpeg-turbo-dev \ 20 | libpng-dev \ 21 | libwebp-dev \ 22 | libxpm-dev \ 23 | libzip-dev \ 24 | ; \ 25 | \ 26 | mkdir -p /tmp/uploadprogress; \ 27 | curl -fsSL -o /tmp/uploadprogress/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \ 28 | echo "$UPLOAD_PROGRESS_SHA256 /tmp/uploadprogress/uploadprogress.tar.gz" | sha256sum -c -; \ 29 | tar -xf /tmp/uploadprogress/uploadprogress.tar.gz -C /tmp/uploadprogress --strip-components=1; \ 30 | \ 31 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ 32 | docker-php-ext-install -j "$(nproc)" \ 33 | bz2 \ 34 | gd \ 35 | mysqli \ 36 | opcache \ 37 | zip \ 38 | bcmath \ 39 | /tmp/uploadprogress \ 40 | ; \ 41 | \ 42 | rm -r /tmp/uploadprogress; \ 43 | \ 44 | runDeps="$( \ 45 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 46 | | tr ',' '\n' \ 47 | | sort -u \ 48 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 49 | )"; \ 50 | apk add --no-network --virtual .phpmyadmin-phpexts-rundeps $runDeps; \ 51 | apk del --no-network .build-deps 52 | 53 | # set recommended PHP.ini settings 54 | # see https://secure.php.net/manual/en/opcache.installation.php 55 | ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl 56 | ENV MAX_EXECUTION_TIME=600 57 | ENV MEMORY_LIMIT=512M 58 | ENV UPLOAD_LIMIT=2048K 59 | ENV TZ=UTC 60 | ENV SESSION_SAVE_PATH=/sessions 61 | RUN set -ex; \ 62 | mkdir $SESSION_SAVE_PATH; \ 63 | mkdir -p $PMA_SSL_DIR; \ 64 | chmod 1777 $SESSION_SAVE_PATH; \ 65 | chmod 755 $PMA_SSL_DIR; \ 66 | chown www-data:www-data /etc/phpmyadmin; \ 67 | chown www-data:www-data $PMA_SSL_DIR; \ 68 | chown www-data:www-data $SESSION_SAVE_PATH; \ 69 | \ 70 | { \ 71 | echo 'opcache.memory_consumption=128'; \ 72 | echo 'opcache.interned_strings_buffer=8'; \ 73 | echo 'opcache.max_accelerated_files=4000'; \ 74 | echo 'opcache.revalidate_freq=2'; \ 75 | echo 'opcache.fast_shutdown=1'; \ 76 | } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ 77 | \ 78 | { \ 79 | echo 'session.cookie_httponly=1'; \ 80 | echo 'session.use_strict_mode=1'; \ 81 | } > $PHP_INI_DIR/conf.d/session-strict.ini; \ 82 | \ 83 | { \ 84 | echo 'allow_url_fopen=Off'; \ 85 | echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ 86 | echo 'max_input_vars=10000'; \ 87 | echo 'memory_limit=${MEMORY_LIMIT}'; \ 88 | echo 'post_max_size=${UPLOAD_LIMIT}'; \ 89 | echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ 90 | echo 'date.timezone=${TZ}'; \ 91 | echo 'session.save_path=${SESSION_SAVE_PATH}'; \ 92 | } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini 93 | 94 | USER www-data:www-data 95 | 96 | # Calculate download URL 97 | ENV VERSION=5.2.3 98 | ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3 99 | ENV URL=https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz 100 | 101 | LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ 102 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ 103 | org.opencontainers.image.authors="The phpMyAdmin Team " \ 104 | org.opencontainers.image.vendor="phpMyAdmin" \ 105 | org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ 106 | org.opencontainers.image.licenses="GPL-2.0-only" \ 107 | org.opencontainers.image.version="${VERSION}" \ 108 | org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ 109 | org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" 110 | 111 | # Download tarball, verify it using gpg and extract 112 | RUN set -ex; \ 113 | \ 114 | export GNUPGHOME="$(mktemp -d)"; \ 115 | export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ 116 | curl -fsSL -o phpMyAdmin.tar.xz $URL; \ 117 | curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ 118 | echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ 119 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$GPGKEY" \ 120 | || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ 121 | || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \ 122 | || gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \ 123 | gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ 124 | tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ 125 | mkdir -p /var/www/html/tmp; \ 126 | gpgconf --kill all; \ 127 | rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ 128 | rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \ 129 | grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 130 | sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \ 131 | grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 132 | php -l /var/www/html/libraries/vendor_config.php; \ 133 | find /var/www/html -type d -exec chmod 555 {} \;; \ 134 | find /var/www/html -type f -exec chmod 444 {} \;; \ 135 | chmod 1777 /var/www/html/tmp; 136 | 137 | # Copy configuration 138 | COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php 139 | COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php 140 | 141 | # Copy main script 142 | COPY docker-entrypoint.sh /docker-entrypoint.sh 143 | 144 | USER root 145 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 146 | CMD ["php-fpm"] 147 | -------------------------------------------------------------------------------- /Dockerfile-debian.template: -------------------------------------------------------------------------------- 1 | FROM php:%%PHP_VERSION%%-%%VARIANT%% 2 | 3 | ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz" 4 | ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5" 5 | 6 | # Install dependencies 7 | RUN set -ex; \ 8 | \ 9 | apt-get update; \ 10 | apt-get install -y --no-install-recommends \ 11 | gnupg \ 12 | dirmngr \ 13 | ; \ 14 | \ 15 | savedAptMark="$(apt-mark showmanual)"; \ 16 | \ 17 | apt-get install -y --no-install-recommends \ 18 | libbz2-dev \ 19 | libfreetype6-dev \ 20 | libjpeg-dev \ 21 | libpng-dev \ 22 | libwebp-dev \ 23 | libxpm-dev \ 24 | libzip-dev \ 25 | ; \ 26 | \ 27 | mkdir -p /tmp/uploadprogress; \ 28 | curl -fsSL -o /tmp/uploadprogress/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \ 29 | echo "$UPLOAD_PROGRESS_SHA256 /tmp/uploadprogress/uploadprogress.tar.gz" | sha256sum -c -; \ 30 | tar -xf /tmp/uploadprogress/uploadprogress.tar.gz -C /tmp/uploadprogress --strip-components=1; \ 31 | \ 32 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ 33 | docker-php-ext-install -j "$(nproc)" \ 34 | bz2 \ 35 | gd \ 36 | mysqli \ 37 | opcache \ 38 | zip \ 39 | bcmath \ 40 | /tmp/uploadprogress \ 41 | ; \ 42 | \ 43 | rm -r /tmp/uploadprogress; \ 44 | \ 45 | apt-mark auto '.*' > /dev/null; \ 46 | apt-mark manual $savedAptMark; \ 47 | extdir="$(php -r 'echo ini_get("extension_dir");')"; \ 48 | ldd "$extdir"/*.so \ 49 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 50 | | sort -u \ 51 | | xargs -r dpkg-query -S \ 52 | | cut -d: -f1 \ 53 | | sort -u \ 54 | | xargs -rt apt-mark manual; \ 55 | \ 56 | # start: Apache specific build 57 | a2enmod remoteip; \ 58 | # end: Apache specific build 59 | \ 60 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 61 | rm -rf /var/lib/apt/lists/*; \ 62 | ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \ 63 | ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \ 64 | err="$(php --version 3>&1 1>&2 2>&3)"; \ 65 | [ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;); 66 | 67 | # set recommended PHP.ini settings 68 | # see https://secure.php.net/manual/en/opcache.installation.php 69 | ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl 70 | ENV MAX_EXECUTION_TIME=600 71 | ENV MEMORY_LIMIT=512M 72 | ENV UPLOAD_LIMIT=2048K 73 | ENV TZ=UTC 74 | ENV SESSION_SAVE_PATH=/sessions 75 | RUN set -ex; \ 76 | mkdir $SESSION_SAVE_PATH; \ 77 | mkdir -p $PMA_SSL_DIR; \ 78 | chmod 1777 $SESSION_SAVE_PATH; \ 79 | chmod 755 $PMA_SSL_DIR; \ 80 | chown www-data:www-data /etc/phpmyadmin; \ 81 | chown www-data:www-data $PMA_SSL_DIR; \ 82 | chown www-data:www-data $SESSION_SAVE_PATH; \ 83 | \ 84 | { \ 85 | echo 'opcache.memory_consumption=128'; \ 86 | echo 'opcache.interned_strings_buffer=8'; \ 87 | echo 'opcache.max_accelerated_files=4000'; \ 88 | echo 'opcache.revalidate_freq=2'; \ 89 | echo 'opcache.fast_shutdown=1'; \ 90 | } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ 91 | \ 92 | { \ 93 | echo 'session.cookie_httponly=1'; \ 94 | echo 'session.use_strict_mode=1'; \ 95 | } > $PHP_INI_DIR/conf.d/session-strict.ini; \ 96 | \ 97 | { \ 98 | echo 'allow_url_fopen=Off'; \ 99 | echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ 100 | echo 'max_input_vars=10000'; \ 101 | echo 'memory_limit=${MEMORY_LIMIT}'; \ 102 | echo 'post_max_size=${UPLOAD_LIMIT}'; \ 103 | echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ 104 | echo 'date.timezone=${TZ}'; \ 105 | echo 'session.save_path=${SESSION_SAVE_PATH}'; \ 106 | } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini 107 | 108 | USER www-data:www-data 109 | 110 | # Calculate download URL 111 | ENV VERSION=%%VERSION%% 112 | ENV SHA256=%%SHA256%% 113 | ENV URL=https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz 114 | 115 | LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ 116 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ 117 | org.opencontainers.image.authors="The phpMyAdmin Team " \ 118 | org.opencontainers.image.vendor="phpMyAdmin" \ 119 | org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ 120 | org.opencontainers.image.licenses="GPL-2.0-only" \ 121 | org.opencontainers.image.version="${VERSION}" \ 122 | org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ 123 | org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" 124 | 125 | # Download tarball, verify it using gpg and extract 126 | RUN set -ex; \ 127 | export GNUPGHOME="$(mktemp -d)"; \ 128 | export GPGKEY="%%GPG_KEY%%"; \ 129 | curl -fsSL -o phpMyAdmin.tar.xz $URL; \ 130 | curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ 131 | echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ 132 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$GPGKEY" \ 133 | || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ 134 | || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \ 135 | || gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \ 136 | gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ 137 | tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ 138 | mkdir -p /var/www/html/tmp; \ 139 | gpgconf --kill all; \ 140 | rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ 141 | rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \ 142 | grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 143 | sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \ 144 | grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 145 | php -l /var/www/html/libraries/vendor_config.php; \ 146 | find /var/www/html -type d -exec chmod 555 {} \;; \ 147 | find /var/www/html -type f -exec chmod 444 {} \;; \ 148 | chmod 1777 /var/www/html/tmp; 149 | 150 | # Copy configuration 151 | COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php 152 | COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php 153 | 154 | # Copy main script 155 | COPY docker-entrypoint.sh /docker-entrypoint.sh 156 | 157 | USER root 158 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 159 | CMD ["%%CMD%%"] 160 | -------------------------------------------------------------------------------- /fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT: created by update.sh from Dockerfile-debian.template 2 | FROM php:8.3-fpm 3 | 4 | ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz" 5 | ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5" 6 | 7 | # Install dependencies 8 | RUN set -ex; \ 9 | \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | gnupg \ 13 | dirmngr \ 14 | ; \ 15 | \ 16 | savedAptMark="$(apt-mark showmanual)"; \ 17 | \ 18 | apt-get install -y --no-install-recommends \ 19 | libbz2-dev \ 20 | libfreetype6-dev \ 21 | libjpeg-dev \ 22 | libpng-dev \ 23 | libwebp-dev \ 24 | libxpm-dev \ 25 | libzip-dev \ 26 | ; \ 27 | \ 28 | mkdir -p /tmp/uploadprogress; \ 29 | curl -fsSL -o /tmp/uploadprogress/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \ 30 | echo "$UPLOAD_PROGRESS_SHA256 /tmp/uploadprogress/uploadprogress.tar.gz" | sha256sum -c -; \ 31 | tar -xf /tmp/uploadprogress/uploadprogress.tar.gz -C /tmp/uploadprogress --strip-components=1; \ 32 | \ 33 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ 34 | docker-php-ext-install -j "$(nproc)" \ 35 | bz2 \ 36 | gd \ 37 | mysqli \ 38 | opcache \ 39 | zip \ 40 | bcmath \ 41 | /tmp/uploadprogress \ 42 | ; \ 43 | \ 44 | rm -r /tmp/uploadprogress; \ 45 | \ 46 | apt-mark auto '.*' > /dev/null; \ 47 | apt-mark manual $savedAptMark; \ 48 | extdir="$(php -r 'echo ini_get("extension_dir");')"; \ 49 | ldd "$extdir"/*.so \ 50 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 51 | | sort -u \ 52 | | xargs -r dpkg-query -S \ 53 | | cut -d: -f1 \ 54 | | sort -u \ 55 | | xargs -rt apt-mark manual; \ 56 | \ 57 | \ 58 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 59 | rm -rf /var/lib/apt/lists/*; \ 60 | ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \ 61 | ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \ 62 | err="$(php --version 3>&1 1>&2 2>&3)"; \ 63 | [ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;); 64 | 65 | # set recommended PHP.ini settings 66 | # see https://secure.php.net/manual/en/opcache.installation.php 67 | ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl 68 | ENV MAX_EXECUTION_TIME=600 69 | ENV MEMORY_LIMIT=512M 70 | ENV UPLOAD_LIMIT=2048K 71 | ENV TZ=UTC 72 | ENV SESSION_SAVE_PATH=/sessions 73 | RUN set -ex; \ 74 | mkdir $SESSION_SAVE_PATH; \ 75 | mkdir -p $PMA_SSL_DIR; \ 76 | chmod 1777 $SESSION_SAVE_PATH; \ 77 | chmod 755 $PMA_SSL_DIR; \ 78 | chown www-data:www-data /etc/phpmyadmin; \ 79 | chown www-data:www-data $PMA_SSL_DIR; \ 80 | chown www-data:www-data $SESSION_SAVE_PATH; \ 81 | \ 82 | { \ 83 | echo 'opcache.memory_consumption=128'; \ 84 | echo 'opcache.interned_strings_buffer=8'; \ 85 | echo 'opcache.max_accelerated_files=4000'; \ 86 | echo 'opcache.revalidate_freq=2'; \ 87 | echo 'opcache.fast_shutdown=1'; \ 88 | } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ 89 | \ 90 | { \ 91 | echo 'session.cookie_httponly=1'; \ 92 | echo 'session.use_strict_mode=1'; \ 93 | } > $PHP_INI_DIR/conf.d/session-strict.ini; \ 94 | \ 95 | { \ 96 | echo 'allow_url_fopen=Off'; \ 97 | echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ 98 | echo 'max_input_vars=10000'; \ 99 | echo 'memory_limit=${MEMORY_LIMIT}'; \ 100 | echo 'post_max_size=${UPLOAD_LIMIT}'; \ 101 | echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ 102 | echo 'date.timezone=${TZ}'; \ 103 | echo 'session.save_path=${SESSION_SAVE_PATH}'; \ 104 | } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini 105 | 106 | USER www-data:www-data 107 | 108 | # Calculate download URL 109 | ENV VERSION=5.2.3 110 | ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3 111 | ENV URL=https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz 112 | 113 | LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ 114 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ 115 | org.opencontainers.image.authors="The phpMyAdmin Team " \ 116 | org.opencontainers.image.vendor="phpMyAdmin" \ 117 | org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ 118 | org.opencontainers.image.licenses="GPL-2.0-only" \ 119 | org.opencontainers.image.version="${VERSION}" \ 120 | org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ 121 | org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" 122 | 123 | # Download tarball, verify it using gpg and extract 124 | RUN set -ex; \ 125 | export GNUPGHOME="$(mktemp -d)"; \ 126 | export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ 127 | curl -fsSL -o phpMyAdmin.tar.xz $URL; \ 128 | curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ 129 | echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ 130 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$GPGKEY" \ 131 | || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ 132 | || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \ 133 | || gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \ 134 | gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ 135 | tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ 136 | mkdir -p /var/www/html/tmp; \ 137 | gpgconf --kill all; \ 138 | rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ 139 | rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \ 140 | grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 141 | sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \ 142 | grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 143 | php -l /var/www/html/libraries/vendor_config.php; \ 144 | find /var/www/html -type d -exec chmod 555 {} \;; \ 145 | find /var/www/html -type f -exec chmod 444 {} \;; \ 146 | chmod 1777 /var/www/html/tmp; 147 | 148 | # Copy configuration 149 | COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php 150 | COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php 151 | 152 | # Copy main script 153 | COPY docker-entrypoint.sh /docker-entrypoint.sh 154 | 155 | USER root 156 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 157 | CMD ["php-fpm"] 158 | -------------------------------------------------------------------------------- /apache/Dockerfile: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT: created by update.sh from Dockerfile-debian.template 2 | FROM php:8.3-apache 3 | 4 | ENV UPLOAD_PROGRESS_EXT_URL="https://github.com/php/pecl-php-uploadprogress/archive/refs/tags/uploadprogress-2.0.2.tar.gz" 5 | ENV UPLOAD_PROGRESS_SHA256="fe3f6cdfcedad563c970c4fd1cda31e422cfc0df5cc9a217d8c80ed3c8d137f5" 6 | 7 | # Install dependencies 8 | RUN set -ex; \ 9 | \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | gnupg \ 13 | dirmngr \ 14 | ; \ 15 | \ 16 | savedAptMark="$(apt-mark showmanual)"; \ 17 | \ 18 | apt-get install -y --no-install-recommends \ 19 | libbz2-dev \ 20 | libfreetype6-dev \ 21 | libjpeg-dev \ 22 | libpng-dev \ 23 | libwebp-dev \ 24 | libxpm-dev \ 25 | libzip-dev \ 26 | ; \ 27 | \ 28 | mkdir -p /tmp/uploadprogress; \ 29 | curl -fsSL -o /tmp/uploadprogress/uploadprogress.tar.gz "$UPLOAD_PROGRESS_EXT_URL"; \ 30 | echo "$UPLOAD_PROGRESS_SHA256 /tmp/uploadprogress/uploadprogress.tar.gz" | sha256sum -c -; \ 31 | tar -xf /tmp/uploadprogress/uploadprogress.tar.gz -C /tmp/uploadprogress --strip-components=1; \ 32 | \ 33 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ 34 | docker-php-ext-install -j "$(nproc)" \ 35 | bz2 \ 36 | gd \ 37 | mysqli \ 38 | opcache \ 39 | zip \ 40 | bcmath \ 41 | /tmp/uploadprogress \ 42 | ; \ 43 | \ 44 | rm -r /tmp/uploadprogress; \ 45 | \ 46 | apt-mark auto '.*' > /dev/null; \ 47 | apt-mark manual $savedAptMark; \ 48 | extdir="$(php -r 'echo ini_get("extension_dir");')"; \ 49 | ldd "$extdir"/*.so \ 50 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 51 | | sort -u \ 52 | | xargs -r dpkg-query -S \ 53 | | cut -d: -f1 \ 54 | | sort -u \ 55 | | xargs -rt apt-mark manual; \ 56 | \ 57 | # start: Apache specific build 58 | a2enmod remoteip; \ 59 | # end: Apache specific build 60 | \ 61 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 62 | rm -rf /var/lib/apt/lists/*; \ 63 | ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \ 64 | ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \ 65 | err="$(php --version 3>&1 1>&2 2>&3)"; \ 66 | [ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;); 67 | 68 | # set recommended PHP.ini settings 69 | # see https://secure.php.net/manual/en/opcache.installation.php 70 | ENV PMA_SSL_DIR=/etc/phpmyadmin/ssl 71 | ENV MAX_EXECUTION_TIME=600 72 | ENV MEMORY_LIMIT=512M 73 | ENV UPLOAD_LIMIT=2048K 74 | ENV TZ=UTC 75 | ENV SESSION_SAVE_PATH=/sessions 76 | RUN set -ex; \ 77 | mkdir $SESSION_SAVE_PATH; \ 78 | mkdir -p $PMA_SSL_DIR; \ 79 | chmod 1777 $SESSION_SAVE_PATH; \ 80 | chmod 755 $PMA_SSL_DIR; \ 81 | chown www-data:www-data /etc/phpmyadmin; \ 82 | chown www-data:www-data $PMA_SSL_DIR; \ 83 | chown www-data:www-data $SESSION_SAVE_PATH; \ 84 | \ 85 | { \ 86 | echo 'opcache.memory_consumption=128'; \ 87 | echo 'opcache.interned_strings_buffer=8'; \ 88 | echo 'opcache.max_accelerated_files=4000'; \ 89 | echo 'opcache.revalidate_freq=2'; \ 90 | echo 'opcache.fast_shutdown=1'; \ 91 | } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ 92 | \ 93 | { \ 94 | echo 'session.cookie_httponly=1'; \ 95 | echo 'session.use_strict_mode=1'; \ 96 | } > $PHP_INI_DIR/conf.d/session-strict.ini; \ 97 | \ 98 | { \ 99 | echo 'allow_url_fopen=Off'; \ 100 | echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ 101 | echo 'max_input_vars=10000'; \ 102 | echo 'memory_limit=${MEMORY_LIMIT}'; \ 103 | echo 'post_max_size=${UPLOAD_LIMIT}'; \ 104 | echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ 105 | echo 'date.timezone=${TZ}'; \ 106 | echo 'session.save_path=${SESSION_SAVE_PATH}'; \ 107 | } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini 108 | 109 | USER www-data:www-data 110 | 111 | # Calculate download URL 112 | ENV VERSION=5.2.3 113 | ENV SHA256=57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3 114 | ENV URL=https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz 115 | 116 | LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ 117 | org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ 118 | org.opencontainers.image.authors="The phpMyAdmin Team " \ 119 | org.opencontainers.image.vendor="phpMyAdmin" \ 120 | org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ 121 | org.opencontainers.image.licenses="GPL-2.0-only" \ 122 | org.opencontainers.image.version="${VERSION}" \ 123 | org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ 124 | org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" 125 | 126 | # Download tarball, verify it using gpg and extract 127 | RUN set -ex; \ 128 | export GNUPGHOME="$(mktemp -d)"; \ 129 | export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ 130 | curl -fsSL -o phpMyAdmin.tar.xz $URL; \ 131 | curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ 132 | echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ 133 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$GPGKEY" \ 134 | || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ 135 | || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY" \ 136 | || gpg --batch --keyserver keys.openpgp.org --recv-keys "$GPGKEY"; \ 137 | gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ 138 | tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ 139 | mkdir -p /var/www/html/tmp; \ 140 | gpgconf --kill all; \ 141 | rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ 142 | rm -r -v /var/www/html/setup/ /var/www/html/examples/ /var/www/html/js/src/ /var/www/html/babel.config.json /var/www/html/doc/html/_sources/ /var/www/html/RELEASE-DATE-$VERSION /var/www/html/CONTRIBUTING.md; \ 143 | grep -q -F "'configFile' => ROOT_PATH . 'config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 144 | sed -i "s@'configFile' => .*@'configFile' => '/etc/phpmyadmin/config.inc.php',@" /var/www/html/libraries/vendor_config.php; \ 145 | grep -q -F "'configFile' => '/etc/phpmyadmin/config.inc.php'," /var/www/html/libraries/vendor_config.php; \ 146 | php -l /var/www/html/libraries/vendor_config.php; \ 147 | find /var/www/html -type d -exec chmod 555 {} \;; \ 148 | find /var/www/html -type f -exec chmod 444 {} \;; \ 149 | chmod 1777 /var/www/html/tmp; 150 | 151 | # Copy configuration 152 | COPY --chown=www-data:www-data config.inc.php /etc/phpmyadmin/config.inc.php 153 | COPY --chown=www-data:www-data helpers.php /etc/phpmyadmin/helpers.php 154 | 155 | # Copy main script 156 | COPY docker-entrypoint.sh /docker-entrypoint.sh 157 | 158 | USER root 159 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 160 | CMD ["apache2-foreground"] 161 | -------------------------------------------------------------------------------- /testing/phpmyadmin_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import os 4 | import subprocess 5 | import re 6 | import sys 7 | 8 | import mechanize 9 | import tempfile 10 | import pytest 11 | 12 | def create_browser(): 13 | br = mechanize.Browser() 14 | 15 | # Ignore robots.txt 16 | br.set_handle_robots(False) 17 | return br 18 | 19 | def do_login(br, url, username, password, server): 20 | # Login page 21 | br.open(url) 22 | 23 | # Fill login form 24 | br.select_form('login_form') 25 | br['pma_username'] = username 26 | br['pma_password'] = password 27 | if server is not None: 28 | br['pma_servername'] = server 29 | 30 | # Login and check if logged in 31 | response = br.submit() 32 | return response 33 | 34 | def get_world_sql_path(): 35 | if os.path.exists('/world.sql'): 36 | return '/world.sql' 37 | elif os.path.exists('./world.sql'): 38 | return './world.sql' 39 | else: 40 | path = os.path.dirname(os.path.realpath(__file__)) 41 | return path + '/world.sql' 42 | 43 | def test_import(url, username, password, server, sqlfile): 44 | if sqlfile is None: 45 | sqlfile = get_world_sql_path() 46 | 47 | br = create_browser() 48 | 49 | response = do_login(br, url, username, password, server) 50 | 51 | assert(b'Server version' in response.read()) 52 | 53 | # Open server import 54 | response = br.follow_link(text_regex=re.compile('Import')) 55 | assert(b'OpenDocument Spreadsheet' in response.read()) 56 | 57 | # Upload SQL file 58 | br.select_form('import') 59 | br.form.add_file(open(sqlfile), 'text/plain', sqlfile) 60 | response = br.submit() 61 | response = response.read() 62 | 63 | assert(b'5326 queries executed' in response) 64 | 65 | 66 | def docker_secret(env_name): 67 | dir_path = os.path.dirname(os.path.realpath(__file__)) 68 | secret_file = tempfile.mkstemp() 69 | 70 | password = "The_super_secret_password" 71 | password_file = open(secret_file[1], 'wb') 72 | password_file.write(str.encode(password)) 73 | password_file.close() 74 | 75 | test_env = {env_name + '_FILE': secret_file[1]} 76 | 77 | # Run entrypoint and afterwards echo the environment variables 78 | result = subprocess.Popen("bash " +dir_path+ "/../docker-entrypoint.sh 'env'", shell=True, stdout=subprocess.PIPE, env=test_env) 79 | output = result.stdout.read().decode() 80 | 81 | assert (env_name + "=" + password) in output 82 | 83 | def test_phpmyadmin_secrets(): 84 | docker_secret('MYSQL_PASSWORD') 85 | docker_secret('MYSQL_ROOT_PASSWORD') 86 | docker_secret('PMA_USER') 87 | docker_secret('PMA_PASSWORD') 88 | docker_secret('PMA_HOSTS') 89 | docker_secret('PMA_HOST') 90 | docker_secret('PMA_CONTROLHOST') 91 | docker_secret('PMA_CONTROLUSER') 92 | docker_secret('PMA_CONTROLPASS') 93 | 94 | def test_is_using_ssl(url, username, password, server): 95 | is_using_ssl = os.environ.get('IS_USING_SSL'); 96 | 97 | br = create_browser() 98 | response = do_login(br, url, username, password, server) 99 | response = response.read() 100 | 101 | assert(b'Server connection' in response) 102 | 103 | if is_using_ssl: 104 | assert(b'SSL is used' in response) 105 | assert(b'SSL is not being used' not in response) 106 | else: 107 | assert(b'SSL is used' not in response) 108 | assert(b'SSL is not being used' in response) 109 | 110 | def test_is_using_ssl_client_cert(url, server): 111 | is_using_ssl = os.environ.get('IS_USING_SSL'); 112 | if not is_using_ssl: 113 | pytest.skip("Missing IS_USING_SSL ENV", allow_module_level=True) 114 | 115 | br = create_browser() 116 | password = "" 117 | response = do_login(br, url, "ssl-specific-user", password, server) 118 | response = response.read() 119 | 120 | assert(b'Server connection' in response) 121 | assert(b'ssl-specific-user@' in response) 122 | 123 | assert(b'SSL is used' in response) 124 | assert(b'SSL is not being used' not in response) 125 | 126 | def test_php_ini(url, username, password, server): 127 | skip_expose_php_test = os.environ.get('SKIP_EXPOSE_PHP_TEST'); 128 | 129 | br = create_browser() 130 | response = do_login(br, url, username, password, server) 131 | response = response.read() 132 | 133 | assert(b'Show PHP information' in response) 134 | 135 | # Open Show PHP information 136 | response = br.follow_link(text_regex=re.compile('Show PHP information')) 137 | response = response.read() 138 | assert(b'PHP Version' in response) 139 | 140 | assert(b'upload_max_filesize' in response) 141 | assert(b'post_max_size' in response) 142 | assert(b'expose_php' in response) 143 | assert(b'session.save_path' in response) 144 | 145 | assert(b'max_execution_time125125' in response) 146 | 147 | assert(b'upload_max_filesize123M123M' in response) 148 | assert(b'post_max_size123M123M' in response) 149 | 150 | if not skip_expose_php_test: 151 | assert(b'expose_phpOffOff' in response) 152 | 153 | assert(b'session.save_path/sessions/sessions' in response) 154 | 155 | def test_import_from_folder(url, username, password, server, sqlfile): 156 | upload_dir = os.environ.get('PMA_UPLOADDIR'); 157 | if not upload_dir: 158 | pytest.skip("Missing PMA_UPLOADDIR ENV", allow_module_level=True) 159 | 160 | # Copy file into the volume 161 | with open(get_world_sql_path(), 'rb') as src, open(upload_dir + '/world-data.sql', 'wb') as dst: 162 | dst.write(src.read()) 163 | 164 | br = create_browser() 165 | 166 | response = do_login(br, url, username, password, server) 167 | 168 | assert(b'Server version' in response.read()) 169 | 170 | # Open server import 171 | response = br.follow_link(text_regex=re.compile('Import')) 172 | response = response.read() 173 | 174 | assert(b'Browse your computer:' in response) 175 | assert(upload_dir.encode() in response) 176 | assert(b'world-data.sql' in response) 177 | 178 | def test_export_to_folder(url, username, password, server, sqlfile): 179 | save_dir = os.environ.get('PMA_SAVEDIR'); 180 | if not save_dir: 181 | pytest.skip("Missing PMA_SAVEDIR ENV", allow_module_level=True) 182 | 183 | # Delete file from previous runs 184 | if os.path.exists(save_dir + "/db_server.sql"): 185 | os.remove(save_dir + "/db_server.sql") 186 | 187 | assert os.path.exists(save_dir + "/db_server.sql") == False 188 | 189 | # Avoid: "The web server does not have permission to save the file" 190 | os.chmod(save_dir , 0o777) 191 | 192 | br = create_browser() 193 | 194 | response = do_login(br, url, username, password, server) 195 | 196 | assert(b'Server version' in response.read()) 197 | 198 | # Open server export 199 | response = br.follow_link(text_regex=re.compile('Export')) 200 | response = response.read() 201 | assert(b'Save on server in the directory' in response) 202 | assert(save_dir.encode() in response) 203 | 204 | br.select_form('dump') 205 | br.find_control("quick_export_onserver").items[0].selected=True 206 | 207 | response = br.submit() 208 | response = response.read() 209 | 210 | assert(b'Dump has been saved to file' in response) 211 | assert(b'Dump has been saved to file /etc/phpmyadmin/exports/db_server.sql' in response) 212 | assert os.path.exists(save_dir + "/db_server.sql") == True 213 | -------------------------------------------------------------------------------- /config.inc.php: -------------------------------------------------------------------------------- 1 | 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | --------------------------------------------------------------------------------