--> -->

TYPO3 - Getting started

The supported way to run TYPO3 on Platform.sh is through Composer . If you do not already have it installed then you should do so before proceeding.

Avoiding deadlock 

A default TYPO3 installation has a risk of deadlocks when run on low-worker PHP-FPM configurations. Specifically, TYPO3 handles 403 and 404 error pages by issuing a full HTTP request back to itself with no timeout, which can lead to process starvation. There are two required steps to avoid this problem:

  1. Add the line

    $GLOBALS['TYPO3_CONF_VARS']['HTTP']['timeout'] = 3;

    to your typo3config/AdditionalConfiguration.php file, which will set an HTTP timeout of 3 seconds instead of the default several minutes. (You may select a different number, but keep it under 10 seconds.)

  2. Install and enable the Local Page Error Handler plugin for TYPO3. The easiest way to do so is through composer:

    composer require pixelant/pxa-lpeh

    that will provide a non-loopback way to handle error pages which avoids this race condition entirely.

Both of these steps are already set in the Platform.sh TYPO3 template , although you will need to enable the plugin yourself post-install.

Configure your app 

The ideal .platform.app.yaml file will vary from project to project, and you are free to customize yours as needed. A recommended baseline TYPO3 configuration is listed below, and can also be found in our TYPO3 template project .

# This file describes an application. You can have multiple applications
# in the same project.

# The name of this app. Must be unique within a project.
name: app

# The type of the application to build.
type: php:7.4
    flavor: composer

# The relationships of the application with services or other applications.
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
    database: 'db:mysql'
    rediscache: 'cache:redis'

# The configuration of app when it is exposed to the web.
            # The public directory of the app, relative to its root.
            root: 'public'
            passthru: '/index.php'
                - 'index.php'
            allow: false
                # Allow access to common static files.
                    allow: true
                    allow: true
                    allow: true
            root: 'public/fileadmin'
            scripts: false
            allow: true
            passthru: '/index.php'
            root: 'public/typo3temp/assets'
            scripts: false
            allow: true
            passthru: '/index.php'
            allow: false
            allow: false

# The size of the persistent disk of the application (in MB).
disk: 2048

# The mounts that will be performed when the package is deployed.
        source: local
        source_path: "typo3temp"
        source: local
        source_path: "fileadmin"
        source: local
        source_path: "var"

# The hooks that will be performed when the package is deployed.
    build: |
        set -e

        # Install the PhpRedis extension
        bash install-redis.sh 5.1.1

        php vendor/bin/typo3cms install:setup --install-steps-config=src/SetupConfiguration.yaml --no-interaction --skip-extension-setup
        php vendor/bin/typo3cms install:generatepackagestates

        # Enable the install tool for 60mins after deployment
        touch public/typo3conf/ENABLE_INSTALL_TOOL

        # Keep the checked-in LocalConfiguration available, but make the actual file writable later-on
        # by creating a symlink which will be accesible below
        if [ -f public/typo3conf/LocalConfiguration.php ]; then
            mv public/typo3conf/LocalConfiguration.php public/typo3conf/LocalConfiguration.FromSource.php
            ln -sf ../../var/LocalConfiguration.php public/typo3conf/LocalConfiguration.php
        # Clean up the FIRST_INSTALL file, that was created
        if [ -f public/FIRST_INSTALL ]; then
            rm public/FIRST_INSTALL
    deploy: |
        set -e
        if [ ! -f var/platformsh.installed ]; then
            # copy the created LocalConfiguration into the writable location
            cp public/typo3conf/LocalConfiguration.FromSource.php var/LocalConfiguration.php
            # This creates the initial admin user with a default password.
            php vendor/bin/typo3cms install:setup \
                --install-steps-config=src/SetupDatabase.yaml \
                --site-setup-type=no \
                --site-name="TYPO3 on Platform.sh" \
                --admin-user-name=admin \
                --admin-password=password \
                --skip-extension-setup \
            php vendor/bin/typo3cms extension:setupactive || true
            touch var/platformsh.installed

        spec: "*/5 * * * *"
        cmd: "vendor/bin/typo3 scheduler:run"