How to set TYPO3_CONTEXT in DDEV

As a TYPO3 developer, setting TYPO3_CONTEXT=Development during development is very very important.

This is because, some errors will not give you meaningful information to help you fix them if the Application Context is not Development.

This happened to me while integrating fluidcontent into flux after an upgrade from TYPO3 v8 to v9. I had a “Flux could not extract a Flux definition…” error which was not very clear.

I only got a meaningful error after setting the Application Context to Development.

More Problems

For me to do set the Application Context, I still had the following problems

  • I used DDEV, so I did not have an apache server and could not set the context in the vhost Configuration with the SetEnv Directive.

The Solution

  • Use DDEV. I recommend DDEV to anyone working with TYPO3. It makes it very very easy to setup and configure a local PHP dev’t environment with composer, databases and server available.
  • Assuming you have a ddev project configured, create a docker-compose.(name).yaml file in the .ddev folder.
  • (name) can be anything. For example docker-compose.context.yaml.
  • Create this file and don’t use the existing docker-compose.yaml file as DDEV overrides it anytime a project is started.

Put this code snippet in the file

version: '3.6'
services:
   web:
    environment:
      - TYPO3_CONTEXT=Development
  • Restart ddev and you are good to go.
  • You can check the new Application Context if you want.

Checking Application Context

  • Login to you TYPO3 backend (Link: example.com/typo3) where example.com is your domain name.
  • Click on this icon undefined.

Then you see something like below showing the application context

So, that is it for this post. If you got any issues with TYPO3, just let me know and let me see how I can chip in.

Untill then, Tschüss !!!!

One thought on “How to set TYPO3_CONTEXT in DDEV

Add yours

  1. Nowadays it can be done by an entry in config.yaml:

    web_environment: [
    TYPO3_CONTEXT=Development
    ]

    The default line in that file is this:

    web_environment: []

    So it’s just one line more and an additional line-break.
    Likely it can be configured in other files too, I never saw the need for it.

    Like

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started