3

My ddev environment always runs in production mode. How to change that?

SetEnv TYPO3_CONTEXT Development

Bernd Wilke πφ
  • 10,390
  • 1
  • 19
  • 38
bschauer
  • 958
  • 9
  • 33

4 Answers4

10

Edit 2023-04-25: There are now many ways to set environment variables that don't require any of this. You can use a .ddev/.env, or add an environment variable to web_environment, etc. See https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container

The answer by @marcel is better these days.

Original answer:

There's an easier way that doesn't involve such complexity.

Create a .ddev/docker-compose.typo3.yaml with these contents:

    services:
      web:
        environment:
          - TYPO3_CONTEXT=Development

This does nothing beyond adding that environment variable in the web container. Note that the name of the docker-compose file is not important, it could be docker-compose.envstuff.yaml

rfay
  • 9,963
  • 1
  • 47
  • 89
8

Just for those who stumble upon this question here. In newer versions of ddev (I have v1.17.5), you have to edit the file .ddev/config.yml with nano o.e. You can just replace the line

web_environment: []

by

web_environment:
 - TYPO3_CONTEXT=Development

Afterwards you have to restart the environment via ddev restart

Marcel Lange
  • 1,504
  • 1
  • 13
  • 15
2

you have to setup an individual nginx configuration. To do so:

  1. start up ddev
  2. ssh into machine with ddev ssh
  3. copy the contents of typo3 config within /etc/nginx/nginx-site-typo3.conf
  4. create nginx-site.conf file within the .ddev directory of your project
  5. copy the standard configuration in that file
  6. Look for "location ~ .php$ { .... }" within the newly created config file
  7. Add the line fastcgi_param TYPO3_CONTEXT YOURCONTEXT;
  8. save the file
  9. do ddev restart

that's it

0

I found the official ddev documentation page for this topic:

https://ddev.readthedocs.io/en/latest/users/usage/cms-settings/#setup-a-base-variant-since-typo3-95

I applied this in a local TYPO3 v12 project and it worked perfectly. So go to your .ddev folder and change the value for web_environment, like so:

web_environment:
- TYPO3_CONTEXT=Development/DDEV

After this change you need to restart your project:

ddev restart
ca1zr
  • 1
  • 3