Your software
My Mautic version is: 3.3.2
My PHP version is: 7.4.16
My Database type and version is: 10.2.37-MariaDB
My OS: Centos 7
Your problem
My problem is: When I’m trying to load new template email I get blank page.
These errors are showing in the log:
[2021-04-06 18:32:53] mautic.CRITICAL: Uncaught PHP Exception RuntimeException: “Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/2d).” at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php line 61 {“exception”:"[object] (RuntimeException(code: 0): Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/2d). at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php:61)"}
Steps I have tried to fix the problem:
I tried to restore/setup file permission but nothing changed.
I tried to set all the permissions to apache user but I still get this:
[2021-04-07 12:09:08] mautic.CRITICAL: Uncaught PHP Exception RuntimeException: “Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/02).” at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php line 61 {“exception”:"[object] (RuntimeException(code: 0): Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/02). at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php:61)"}
If you are using a Docker environment this also can be caused by a bad (i.e. not writable) location defined in app/config/local.php under the tmp_path key.
On my side, in a Docker env, the Docker volume was mounted to the /var/www/html/inside the container, which means all the Mautic content was at that location.
The problem is that my key was:
'tmp_path' => '/var/www/tmp/',
which wasn’t a writable location inside the container, changing it to:
'tmp_path' => '/var/www/html/var/tmp',
fixed the issue as it was pointing to a location inside the mapped Docker volume.