How to set date.timezone and what is the correct place to do it

Solution 1:

The fpm/conf.d/ is scanned for additional .ini files, making it easier to separate configuration for example per module. Those are scanned for every FPM pool, i.e. it's a global configuration just like the php.ini.

You can override individual settings for a single pool in your fpm/pool.d/poolname.conf:

php_admin_value[date.timezone] = Europe/Berlin

Shortly on PHP FPM pools that allows using separate settings, resources & user (permissions):

  1. The default pool is configured in fpm/pool.d/www.conf for listening a UNIX socket:

    listen = /run/php/php7.2-fpm.sock
    

    Also notice that it runs as the user www-data (or nginx), having all its permissions.

  2. Nginx server{} block passes PHP script to this socket for the PHP FPM pool to handle:

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        # another fastcgi options
    }
    
  3. You can run the PHP of your single project as a separated user mautic by creating an additional FPM pool, e.g. fpm/pool.d/mautic.conf for your Mautic project:

    [mautic]
    user = mautic
    group = mautic
    listen = /run/php/mautic.sock
    chdir = /var/www/mautic   # or /home/mautic etc.
    listen.owner = www-data   # or nginx(?) to let Nginx use the socket
    listen.group = www-data
    
    php_admin_value[date.timezone] = Europe/Berlin
    

    And naturally use this new /run/php/mautic.sock in the relevant Nginx configuration.

The official documentation starts from where you should already know the basic idea, making it a bit hard for beginners. Luckily there are tutorials, or you could even enjoy watching a video.