Skip to main content
Version: 2024.4

Environment Variables Reference

This page documents all environment variables used in Pimcore PaaS deployments. Understanding these variables is essential for successful configuration.

Overview: Three Variable Contexts

Pimcore PaaS uses environment variables in three distinct phases:

  1. Local Development — Variables in your .env file for running Pimcore locally with your actual services
  2. Build Phase — Placeholder values that allow Symfony's dependency injection container to compile during deployment (services aren't available yet)
  3. Runtime — Real connection values automatically configured from PLATFORM_RELATIONSHIPS by config/pimcore/startup.php

Where Variables Are Configured

ContextLocationPurposeWhen Set
Local Development.env file in project rootReal connection details for your local database, Redis, and other servicesBefore running pimcore-install
Build Phase.platform-scripts/build/export-vars.shPlaceholder values to allow Symfony DI container compilationAutomatically during PaaS build
Runtimeconfig/pimcore/startup.phpReal connection values from PLATFORM_RELATIONSHIPSAutomatically when application starts
PaaS ConsoleSettings → Variables in Console UIAdmin credentials, license token, encryption secretsManual setup required before first deployment

PaaS Console Variables (Must Set Manually)

These must be set in the PaaS Console before your first deployment. Without them, your deployment will fail or your application won't start properly.

Navigate to Settings → Variables in the Pimcore PaaS Console and create the following:

Variable NameDescriptionSensitive?Example Value
env:APP_ENVApplication environmentNoprod or dev
env:PIMCORE_TOKENLicense token from your Pimcore certificateYes (tick)<your-pimcore-license-token>
env:PIMCORE_INSTALL_ADMIN_USERNAMEAdmin username for Pimcore backendYes (tick)<your-admin-username>
env:PIMCORE_INSTALL_ADMIN_PASSWORDAdmin password for Pimcore backendYes (tick)<your-secure-password>
env:PIMCORE_INSTALL_PRODUCT_KEYProduct key from product registrationNo<product-key-from-registration>
env:PIMCORE_INSTALL_INSTANCE_IDENTIFIERInstance identifier from product registrationNo<instance-identifier>
env:PIMCORE_INSTALL_ENCRYPTION_SECRETEncryption secret generated by pimcore-paas-product-registrationYes (tick)<encryption-secret>

Note: The product key, instance identifier, and encryption secret are generated when you run ./vendor/bin/pimcore-paas-product-registration locally.

Local .env Variables

For local development, set these in your .env file in the project root:

VariableDescriptionExample Value
APP_ENVApplication environmentdev
APP_DEBUGEnable Symfony debug modetrue
PIMCORE_DEV_MODEEnable Pimcore development featuresfalse
PIMCORE_TOKENLicense token (same as Console)<your-pimcore-license-token>
DATABASE_HOSTLocal database hostname127.0.0.1 or mariadb (Docker)
DATABASE_PORTLocal database port3306
DATABASE_USERLocal database usernameroot or pimcore
DATABASE_PASSWORDLocal database password(your local password)
DATABASE_DBNAMELocal database namepimcore
REDIS_HOSTLocal Redis hostname127.0.0.1 or redis (Docker)
REDIS_PORTLocal Redis port6379
GOTENBERG_IPLocal Gotenberg service IPDocker container IP or placeholder if not used
GOTENBERG_PORTLocal Gotenberg service port3000 or placeholder if not used
PIMCORE_INSTALL_INSTANCE_IDENTIFIERFrom product registration(generated value)
PIMCORE_INSTALL_PRODUCT_KEYFrom product registration(generated value)
PIMCORE_INSTALL_ENCRYPTION_SECRETFrom product registration(generated value)

Build-Phase Service Configuration Variables

Purpose: During the PaaS build phase, the Symfony dependency injection container must be compiled. However, services like MariaDB and Redis aren't available yet—they only become available at runtime. These variables must be available in the environment with placeholder values during the build to allow Symfony compilation to succeed.

Behavior:

  • PaaS deployment: During the build, these variables are exported by .platform-scripts/build/export-vars.sh so they are available to Symfony. At runtime, config/pimcore/startup.php automatically overwrites them with real service credentials from PLATFORM_RELATIONSHIPS. The actual placeholder values don't matter—only their presence during build.
  • Local development: Define these variables in your .env file so that local composer commands and Symfony can compile the container. Update them to point to your actual local services. If you don't use a service locally, the placeholder values are fine.

Location (PaaS build): .platform-scripts/build/export-vars.sh (exports these variables into the build environment)

VariablePlaceholder ValueReal Value Source (PaaS runtime)Local Development
DATABASE_HOSTmariadbPLATFORM_RELATIONSHIPS['database']['host']Your local DB host (e.g., 127.0.0.1)
DATABASE_PORT1234PLATFORM_RELATIONSHIPS['database']['port']Your local DB port (e.g., 3306)
DATABASE_USERuserPLATFORM_RELATIONSHIPS['database']['username']Your local DB username
DATABASE_PASSWORDpassPLATFORM_RELATIONSHIPS['database']['password']Your local DB password
DATABASE_DBNAMEpimcorePLATFORM_RELATIONSHIPS['database']['path']Your local DB name
REDIS_HOSTredisPLATFORM_RELATIONSHIPS['redis']['host']Your local Redis host (e.g., 127.0.0.1 or redis for Docker)
REDIS_PORT1234PLATFORM_RELATIONSHIPS['redis']['port']Your local Redis port (e.g., 6379)
GOTENBERG_IP1.2.3.4PLATFORM_RELATIONSHIPS['gotenberg8']['ip']Your local Gotenberg IP (if using)
GOTENBERG_PORT1234PLATFORM_RELATIONSHIPS['gotenberg8']['port']Your local Gotenberg port (if using)
PIMCORE_ES_CLIENT_HOSTelastic:1234PLATFORM_RELATIONSHIPS['elasticsearch']['host'] . ':' . ['port'] (if enabled)Your local Elasticsearch (if using)
PIMCORE_ES_CLIENT_USERNAMEuser(Not used in current config)Your local Elasticsearch username (if using)
PIMCORE_ES_CLIENT_PASSpass(Not used in current config)Your local Elasticsearch password (if using)
PIMCORE_ENCRYPTION_SECRETxyzBuild-phase placeholder; at runtime the actual encryption secret is provided via the PIMCORE_INSTALL_ENCRYPTION_SECRET Console variableUse placeholder value
CHROMIUM_HOSTchrome(Not currently mapped in startup.php)Your local Chrome/Chromium host (if using)
CHROMIUM_PORT1234(Not currently mapped in startup.php)Your local Chrome/Chromium port (if using)
RABBITMQ_URLamqp://user:pass@rabbitmq:1234PLATFORM_RELATIONSHIPS['queue'] (if enabled)Your local RabbitMQ URL (if using)
PIMCORE_OPENSEARCH_CLIENT_HOSThttps://opensearch:9200PLATFORM_RELATIONSHIPS['opensearch']['host'] . ':' . ['port'] (if enabled)Your local OpenSearch (if using)

Auto-Configured Variables (Runtime)

At runtime, config/pimcore/startup.php uses the Platform.sh Config Reader library to extract real connection details from the PLATFORM_RELATIONSHIPS environment variable and sets them for use by Pimcore and Symfony.

VariableSource ServicePurpose
DATABASE_HOSTdatabase relationshipMariaDB connection host
DATABASE_PORTdatabase relationshipMariaDB connection port
DATABASE_USERdatabase relationshipMariaDB username
DATABASE_PASSWORDdatabase relationshipMariaDB password
DATABASE_DBNAMEdatabase relationshipMariaDB database name
REDIS_HOSTredis relationshipRedis cache host
REDIS_PORTredis relationshipRedis cache port
REDIS_SESSIONS_HOSTredis-sessions relationshipRedis session storage host
REDIS_SESSIONS_PORTredis-sessions relationshipRedis session storage port
GOTENBERG_IPgotenberg8 relationshipGotenberg PDF service IP
GOTENBERG_PORTgotenberg8 relationshipGotenberg PDF service port
GOTENBERG_HOST_URLPrimary route from PLATFORM_ROUTESPublic URL for Gotenberg callbacks
PIMCORE_ES_CLIENT_HOSTelasticsearch relationship (if enabled)Elasticsearch host:port
RABBITMQ_URLqueue relationship (if enabled)RabbitMQ connection string
PIMCORE_OPENSEARCH_CLIENT_HOSTopensearch relationship (if enabled)OpenSearch host:port
MERCURE_URLmercure route (if enabled)Mercure hub URL for real-time features
PIMCORE_IS_PRODUCTION_SYSTEMPlatform.sh environment typetrue on production branch, false otherwise

Reference: See config/pimcore/startup.php lines 5-84 for implementation details.

Optional Variables

These variables are used for advanced configurations and are not required for basic deployments.

S3 Object Storage

If using Amazon S3 for asset storage (configured in config/platform.yaml):

VariableDescriptionExample Value
S3_STORAGE_KEYAWS access key IDAKIAIOSFODNN7EXAMPLE
S3_STORAGE_SECRETAWS secret access keywJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
S3_PUBLIC_BUCKETS3 bucket for public assets (thumbnails)my-pimcore-public
S3_PRIVATE_BUCKETS3 bucket for private storagemy-pimcore-private

Configuration location: config/platform.yaml lines 11-245 (commented out by default)

Class Definition Writable

VariableDescriptionExample Value
PIMCORE_CLASS_DEFINITION_WRITABLEAllow class definitions to be edited in productiontrue or false

Note: This is generally not recommended for production environments.

Mercure Real-Time Updates

If using Pimcore Direct Edit or Studio with Mercure:

VariableDescriptionSet By
MERCURE_URLMercure hub URLAutomatically set by startup.php from routes

Configuration location: config/platform.yaml lines 131-167 (commented out by default)

Web-to-Print (Gotenberg)

VariableDescriptionSet By
GOTENBERG_HOST_URLPublic URL for Gotenberg callbacksAutomatically set by startup.php

Configuration location: config/platform.yaml lines 138-146 (commented out by default)

Troubleshooting

Missing Console Variables

Symptom: Deployment fails with error message like:

Environment variable "PIMCORE_TOKEN" not set

Solution: Go to Settings → Variables in the PaaS Console and ensure all 7 required variables are set (see "PaaS Console Variables" section above).


Missing Build-Phase Service Variables

Symptom: Build fails during composer install or Symfony container compilation with:

Environment variable not found: "DATABASE_HOST"

Solution: Check that .platform-scripts/build/export-vars.sh exists and is being sourced in your build hook. Verify the file contains all required placeholder variable exports.

Reference: Your build hook (defined in .platform/applications.yaml or included via .upsun/includes/hooks.yaml) should source the script:

hooks:
build: |
set -e
. .platform-scripts/build/export-vars.sh
composer install --no-interaction --optimize-autoloader

Wrong Runtime Values

Symptom: Application connects to wrong database or services at runtime, or connections fail.

Solution:

  1. Check that config/pimcore/startup.php is being loaded by your application
  2. Verify the file is reading from PLATFORM_RELATIONSHIPS correctly
  3. Use SSH to inspect environment: pimcore-cloud sshecho $PLATFORM_RELATIONSHIPS | base64 -d | jq
  4. Ensure relationship names in .platform/applications.yaml match those used in startup.php

Common mismatch: If you renamed a relationship in .platform/applications.yaml (e.g., databasedb), you must update startup.php accordingly.


Product Registration Variables Not Working

Symptom: Pimcore shows license errors or product registration prompts after deployment.

Solution:

  1. Ensure you ran ./vendor/bin/pimcore-paas-product-registration locally and followed the registration URL
  2. Copy the generated values to both:
    • Local .env file (for local development)
    • PaaS Console → Settings → Variables (for production)
  3. Verify variable names exactly match: PIMCORE_INSTALL_INSTANCE_IDENTIFIER, PIMCORE_INSTALL_PRODUCT_KEY, PIMCORE_INSTALL_ENCRYPTION_SECRET

See Also