6

This is a problem I've had for three or four years, but never solved. I send a monthly mailing to about 50k contacts using CiviMail. Each mailing is scheduled using the standard CiviCRM job scheduling. All works fine except that during the sending, the templates_c/en_GB folder grows to about 30GB or more, and has to be emptied manually (either from the command line or using the the CiviCRM Clean Up Caches page) to stop the server from running out of disk space. The files and directories which are being created under templates_c/en_GB/ all seem to have plausible permissions (read and write for the Apache user, read only for everyone else), so I don't understand why they're not being cleared.

Can anyone suggest anywhere to start looking for a solution? Thanks.

This happens with the following set-up, but I have had the problem for a long time, with all previous versions as well.

CiviCRM 4.7.19
Joomla 3.7.2
php 7.0.19
MySQL 5.6.36

4 Answers 4

2

Investigating this one too. The 'Clean-up Temporary Data and Files' doesn't clean the tplCache by default (oddly). You can make it do so by adding it to the command parameters:

enter image description here

1
  • Thank you. In the end I got round the problem by breaking large mailings up into batches of 1000 using the CiviMail settings, but the tplCache=1 is a much neater solution. See also civicrm.stackexchange.com/questions/41876/…
    – Jern
    Commented Feb 29 at 9:45
4

Cache files are cleared by a scheduled job, which isn't enabled by default.

  • Go to Administer menu » System Settings » Scheduled Jobs.
  • Find the row labeled Clean-up Temporary Data and Files.
  • On that row, click more menu » Enable.
2
  • I have this enabled but still have to manually clear the templates_c file almost daily. Not for the reasons stated about but just in general, parts of the CRM or website won't load until I do. Are there any other considerations along with this to add?
    – Christia
    Commented Aug 16, 2018 at 18:41
  • @christia that sounds like you have a file ownership (and/or permissions) issue. If this is happening almost daily, and I assume you're not logging into the server daily - that suggests that the Unix user running cron isn't the same as the Unix user running your webserver. Commented Aug 16, 2018 at 19:41
0

For the workaround, you can try to go to /civicrm?directoryCleanup=1.

&directoryCleanup=1 empties template cache in civicrm/templates_c.

Read more: https://docs.civicrm.org/dev/en/latest/tools/debugging/#using-url-parameters.

-3

Try changing the templates_c folder permissions to 777 recursively so that every sub directory would have 777 permission also.

1
  • Setting permissions to 777 is almost never a good idea, and hides the underlying permission issue. Additionally, this does nothing to prevent CiviCRM from creating new template_c files with the default permissions. Commented Jan 4, 2018 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.